Read integers from standard input, separated by spaces or
newlines, until end of input (EOF). Determine and print
how many distinct values appear in the sequence.
The data are read from standard input (in the format described), not from a
file. Use while (cin >> x) to detect end of input.
Input:
One or more lines contain integers, separated by
spaces or newlines.
- the total number of values read is between 0 and 1000
- values are integers between -1.000.000 and 1.000.000
Output:
The program prints to standard output a single non-negative integer: how many
distinct values were read. If the input is empty, the program prints
0.
Example:
Input:
1 2 3 2 1 4 5 3
Output:
5