string-permutations-1

You are given a list of names. Your task is to find all the distinct names in the list and after that
find the frequency count of all these distinct names in the origninal list.
We are interested in the maximum value of the frequency. You have to print this maximum frequency. If, the 
maximum value of the frequency occurs a number of times, that is, more than one distinct name has the 
same frequency, in that case, output sum of all these maximum values.

INPUT
The first line of input contains a positive integer, t, the number of lines/ names to follow.
After that t lines follow, each contains a string S.

OUTPUT
Output contains a single integer value, that is, the required answer.

CONSTRAINTS
1 ≤ t ≤ 100000
1 ≤ |S| ≤30
S contains only lower case characters.

SAMPLE INPUT
8
veronica
bill
mark
veronica
bill
kevin
hillary
jack

SAMPLE OUTPUT
4

Source: hackerearth | Difficulty: EASY


Solutions:
t=eval(input())
d=dict()
for i in range(t):
	s=input()
	if s not in d:
		d[s]=1
	else:
		d[s]+=1
#print sorted(d,key=d.get,reverse=True)
q=sorted(d,key=d.get,reverse=True)
li=dict()
sum=d[q[0]]
li[q[0]]=d[q[0]]
for i in range(1,len(q)):
	if d[q[i]]==sum:
		li[q[i]]=d[q[i]]
res=0
for i in li:
	res+=li.get(i)
print(res)
	
	


dic = {}
for _ in range(int(input())):
	arr = input()
	if arr in dic :
		dic[arr] += 1
	else:
		dic[arr] = 1
max_val = max(dic.values())
res = 0
for k in dic:
	if max_val == dic[k]:
		res +=1
print(res*max_val)



'''
# 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())
dic = {}
while(t>0):
	x = input()
	if x in dic:
		dic[x]+=1
	else:
		dic[x]=1
	t-=1

c=0
pre=0
for w in sorted(dic, key=dic.get, reverse=True):
	if dic[w]>=pre:
		c+=dic[w]
		pre=dic[w]
	else:
		break
print(c)
	


from collections import Counter
from collections import defaultdict
t=int(input())
li=[]
count=0
for _ in range(t):
	x=input().strip()
	li.append(x)
counts=Counter(li)
temp=list(counts.values())

m=max(temp)
for i in temp:
	if i==m:
		count+=1

ans=m*count
print(ans)