P25349 [AtCoder] Bags and Balls
普及+
题目描述

Problem Description

There are two bags, $ A $ and $ B $. Each bag contains two balls. Each ball has an integer written on it.

You wanted to take one ball from bag $ A $ and one ball from bag $ B $, and check the integers written on the two balls. However, you found that one of the integers on one of the balls was unreadable. Furthermore, you couldn't remember which bag each of the two balls originally came from.

You decided to guess the integer on the unreadable ball based on the integer on the other ball.

Input Format

The input is given from the standard input in the following format:

$ A_1 $ $ A_2 $ $ B_1 $ $ B_2 $ $ C $

  • The first line contains two integers $ A_1 $, $A_2\ (1\ ≦\ A_1\ ≦\ A_2\ ≦\ 100)$ separated by a space. These represent the integers written on the balls in bag $ A $.
  • The second line contains two integers $ B_1 $, $B_2\ (1\ ≦\ B_1\ ≦\ B_2\ ≦\ 100)$ separated by a space. These represent the integers written on the balls in bag $ B $.
  • The third line contains an integer $C\ (1\ ≦\ C\ ≦\ 100)$. This represents the integer written on one of the balls you took out.
  • It is guaranteed that $ C=A_1 $, $ C=A_2 $, $ C=B_1 $, or $ C=B_2 $ holds.

Output Format

Suppose the possible integers for the unreadable ball are $ S_1 $, ... , $S_M\ (1≦S_1<...<S_M≦100)$. The output consists of $ M+1 $ lines.

The first line should contain the number of possible integers $ M $.

The next $ M $ lines should contain the integers $ S_i $ for $i\ (1≦i≦M)$.

Ensure there is a newline at the end of the output.

Sample Input and Output

Sample Input #1

12 18
19 20
20

Sample Output #1

2
12
18

Sample Input #2

10 10
20 20
10

Sample Output #2

1
20

Sample Input #3

2 3
1 2
2

Sample Output #3

3
1
2
3

Notes/Hints

Sample Explanation 1

The possible pairs of integers (integer from bag $ A $, integer from bag $ B $) are ($ 12 $, $ 19 $), ($ 12 $, $ 20 $), ($ 18 $, $ 19 $), and ($ 18 $, $ 20 $). Among these, the integers that could be the other integer when one is $ 20 $ are $ 12 $ and $ 18 $.

Sample Explanation 2

The only possible pair of integers (integer from bag $ A $, integer from bag $ B $) is ($ 10 $, $ 20 $).

Sample Explanation 3

The possible pairs of integers (integer from bag $ A $, integer from bag $ B $) are ($ 2 $, $ 1 $), ($ 2 $, $ 2 $), ($ 2 $, $ 3 $), ($ 3 $, $ 1 $), ($ 3 $, $ 2 $), and ($ 3 $, $ 3 $). Among these, the integers that could be the other integer when one is $ 2 $ are $ 1 $, $ 2 $, and $ 3 $.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
12 18 19 20 20
样例输出
2 12 18