Wednesday, July 19, 2017

Unique count of Winners

Certain number of people play a card game. They play N rounds. The names of the winner in each round is passed as the input to the program. The program must print the unique count of the winners.

Input Format:

The first line contains the values of N. N lines contain the names of the winners.

Output Format:

The first line contains the unique count of winners.

Boundary Conditions: 1 <= N <= 100 Length of name is from 3 to 100

Example Input/Output 1:

Input:
6
Arun
Bhamini
Arun
Derek
Sahul
Bhamini

Output:
4

Solution:

n = int(input())
s = []
for _ in range(n):
    s.append(input().strip())

print(len(set(s)))
Share: