Problem:
Score : 100 points

Problem Statement

AtCoDeer the deer recently bought three paint cans.
The color of the one he bought two days ago is a, the color of the one he bought yesterday is b, and the color of the one he bought today is c.
Here, the color of each paint can is represented by an integer between 1 and 100, inclusive.

Since he is forgetful, he might have bought more than one paint can in the same color.
Count the number of different kinds of colors of these paint cans and tell him.

Constraints

1≦a,b,c≦100

Input

The input is given from Standard Input in the following format:

a b c

Output

Print the number of different kinds of colors of the paint cans.

Sample Input 1

3 1 4

Sample Output 1

3

Three different colors: 1, 3, and 4.

Sample Input 2

3 3 33

Sample Output 2

2

Two different colors: 3 and 33.

Solution in Java (OpenJDK 1.8.0) (judge verdict: Wrong Answer)


import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int setSize = 0;
		String msgOut = "";
		TreeSet<Integer> hs = new TreeSet<Integer>();
		for (int i = 0; i < 3; i++) {
			hs.add(sc.nextInt());
		}
		setSize = hs.size();
		ArrayList<Integer> lst=new ArrayList<Integer>(hs);
		switch (setSize) {
		case 1:
			msgOut =String.format( "One different colors: %d",lst.get(0));
			break;
		case 2:
			msgOut = String.format( "Two different colors: %d and %d",lst.get(0),lst.get(1));
			break;
		case 3:
			msgOut =String.format(  "Three different colors: %d,%d and %d",lst.get(0),lst.get(1),lst.get(2));
			break;
		}
		System.out.println(hs.size());
		System.out.println(msgOut);

	}

}