Number of different elements
Problem
Given a non-decreasing sorted list of numbers. Determine how many different elements it contains.
Input
Enter a list of numbers. All numbers in the list are on the same line. The number of numbers is not more than 1000. Each number is less than 2*10
9.
Imprint
Print the answer to the problem.
Examples
# |
Input |
Output |
1 |
1 2 2 3 3 3 |
3 |
Note
To read data in C++, use a loop
while(cin >> a)
{
// work with number a
}
You can read data in Python directly into an array
A = list(map(int, input().split()))
Запрещенные операторы: sort
; min
; max
; reverse
; count
; sum
; index