vada-pav-list-3

Problem :

Chotu's father is the owner of a Vada Pav shop. One Sunday, his father takes him to the shop. Father tells him that at the end of the day, Chotu has to give him a list consisting of the names of all the customers on that day who bought Vada Pav(s) from the shop. The list should not have the names of any of the customers being repeated and it should be such that the lexicographically smallest name comes first, ie., the names should be sorted in dictionary order. 

As and when a particular customer buys a Vada Pav, Chotu writes down the name of that particular customer. Chotu's initial list is ready, but, he is confused as to how to make the list Father expects from him. Chotu comes to you for help. Your job now is to create the final list, as Father expects from Chotu.

Input :

First line consists of N, the number of names of customers in Chotu's initial list. The next N lines are such that each line consists of a customer's name.

Output :

On the first line, print the total number of names appearing in Chotu's final list. Then print the list such that every customer's name is printed on a new line.

Constraints :

1 ≤ N ≤ 10^6

1 ≤ Length of names of customers ≤ 5 

Customers' names consist only of lower case English alphabets (a-z).

Note : Some test files contain large data. Use scanf/printf instead of cin/cout .

SAMPLE INPUT
11
babu
anand
rani
aarti
nandu
rani
rani
ap
anand
babu
nandu

SAMPLE OUTPUT
6
aarti
anand
ap
babu
nandu
rani

Difficulty: EASY
Tags: String algorithms

Data structures
Skill types: Data structures

Starter code:

Solutions:
t=eval(input())
l=[]
for x in range(0,t):
	s=input()
	l.append(s)
	#sot=sorted(l)
d=sorted(set(l))
print(len(d))
for each in d:
	print(each)


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
from sets import Set
t=int(eval(input()))
arr=[]
item=set()
while(t):
	t-=1
	str1=input()
	item.add(str1)
arr=list(item)
arr.sort()
print((len(arr)))
for name in arr:
	print(name)

	


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''

t = int(input())
A = set()
for i in range(t):
	A.add(input())
A = sorted(A)
print(len(A))
for i in A:
	print(i)


n=int(input())
a=[]
for i in range(0,n):
	x=input()
	a.append(x)	
y=len(set(a))
print(y)
for i in sorted(set(a)):
	print(i)


temp=[]
for _ in range(eval(input())):
	x=input()
	temp.append(x)
temp=set(temp)
print(len(temp))
for i in sorted(temp):
	print(i)


n = int(input())

s = set([])

while n:
	n-=1
	
	s.add(input().strip())
l = list(s)
l.sort()
print(len(l))
for i in l:
	print(i)
	


n=int(input())
i=0
names=[]
while i<n:
	t=input()
	names.append(t)
	i=i+1
name=set(names)
name=list(name)
name=sorted(name)
print(len(name))
j=0
while j<len(name):
	print(name[j])
	j=j+1


t=eval(input())
l=[]
for x in range(0,t):
	s=input()
	l.append(s)
	#sot=sorted(l)
d=sorted(set(l))
print(len(d))
for each in d:
	print(each)
	 


listi = []
for i in range(eval(input())):
	s = input()
	listi.append(s)
ans = list(set(listi))
ans.sort()
print(len(ans))
for i in ans:
	print(i)


listi = []
for i in range(eval(input())):
	s = input()
	listi.append(s)
ans = list(set(listi))
ans.sort()
print(len(ans))

for i in ans:
	print(i)


t=eval(input())
l=[]
while(t):
	s=input()
	l.append(s)
	t-=1
l=sorted(set(l))
print((len(l)))
for i in l:
	print (i)


t=eval(input())
a=[]
b=[]
while(t):
	t-=1
	a.append(input())
b=list(set(a))
b.sort()
print(len(b))
for x in  b:
	print(x)


test=eval(input())
arr=[]
for i in range(test):
	arr.append(input())
arr=sorted(set(arr))
print(len(arr))
for name in arr:
	print(name)


t=eval(input());d=set();i=0
while i<t:d.add(input());i+=1
print(len(d))
d=sorted(d)
for i in d:
	print(i)


n=int(eval(input()))

s=[]
for i in range(0,n):
	s.append(input())

list.sort(s)

s1=set(s)
s=list(s1)

list.sort(s)

print(len(s))
for i in s:
	print(i)


t=eval(input())
l=[]
for x in range(0,t):
	s=input()
	l.append(s)
	#sot=sorted(l)
d=sorted(set(l))
print(len(d))
for each in d:
	print(each)


t=eval(input())
l=[]
for x in range(0,t):
	s=input()
	l.append(s)
	#sot=sorted(l)
d=sorted(set(l))
print(len(d))
for each in d:
	print(each)
	


N=int(input())
Customers=set()
CustomersList=[]
for _ in range(N):
	s=input()
	Customers.add(s)
	CustomersList.append(s)
print(len(Customers))
CustomersList.sort()
for name in CustomersList:
	if name in Customers:
		print(name)
		Customers.remove(name)


N = eval(input())
names = []
for i in range(int(N)):
	names.append(input())
lis = list(set(names))
lis.sort()
print(len(lis))
for i in lis:
	print(i)


n=eval(input())
d={}
while n:
	s=input()
	if(s not in d):
		d[s]=1
	else:
		d[s]+=1
	n=n-1
print(len(d))
for k in sorted(d):
	print(k)


users = []
t = eval(input())
while(t):
	t  -= 1
	users.append(input())
users = list(set(users))
users.sort()
print(len(users))
for a in users:
	print(a)
	


d=set()
for i in enumerate(range(eval(input()))):
	d.add(input())
print(len(d))
for i in sorted(d):
	print(i)


l=[]
for _ in range(eval(input())):
	l.append(input())
a=sorted(list(set(l)))
print(len(a))
print("\n".join(a))


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
t=int(input())
names=[]
for i in range(t):
	names.append(input())
nameSet=set(names)
print(len(nameSet))
nameSet=sorted(nameSet)
for i in range(len(nameSet)):
	print(nameSet[i])


li=[]
for _ in range(int(input())):
	li.append(input())
li=list(set(li))
li.sort()
print((len(li)))
for i in li :
	print(i)