Problem:
Score: 100 points

Problem Statement

A triple of numbers is said to be poor when two of those numbers are equal but the other number is different from those two numbers.

You will be given three integers A, B, and C. If this triple is poor, print Yes; otherwise, print No.

Constraints

A, B, and C are all integers between 1 and 9 (inclusive).

Input

Input is given from Standard Input in the following format:

A B C

Output

If the given triple is poor, print Yes; otherwise, print No.

Sample Input 1

5 7 5

Sample Output 1

Yes

A and C are equal, but B is different from those two numbers, so this triple is poor.

Sample Input 2

4 4 4

Sample Output 2

No

A, B, and C are all equal, so this triple is not poor.

Sample Input 3

4 9 6

Sample Output 3

No

Sample Input 4

3 3 4

Sample Output 4

Yes

Solution in Java8 (OpenJDK 1.8.0) (judge verdict: Runtime Error)

import java.util.*;

class Main{
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int n = stdIn.nextInt();
        String s[] = new String [n];
        
        ArrayList<String> dir = new ArrayList<String>();
        ArrayList<Integer> count = new ArrayList<>();
        s[0] = stdIn.next();
        dir.add(s[0]);
        count.add(1);
        for(int i = 1; i < n; i++){
          s[i] = stdIn.next();
          for(int j = 0; j < dir.size(); j++){
            if(s[i].compareTo(dir.get(j)) == 0) {count.add(j, count.get(j)+1); break;}
            if(s[i].compareTo(dir.get(j)) < 0 ){
              if(j == 0) {dir.add(0, s[i]); count.add(0, 1); break;}
              dir.add(j-1, s[i]);
              count.add(j-1, 1);
              break;
            }
            if(dir.size() - 1 == j) {dir.add(s[i]); count.add(1); break;}
          }
        }

        int maxCount = count.get(0);
        for(int i = 0; i < n; i++){
          if(maxCount != count.get(i)) break;
          System.out.println(dir.get(i));
        }
    }
}