-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathc2.py
More file actions
39 lines (32 loc) · 908 Bytes
/
c2.py
File metadata and controls
39 lines (32 loc) · 908 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from collections import Counter
def comp_logo(s):
my_dict=list(dict(Counter(s)).items())
c=dict(Counter(s))
print(my_dict)
lis=[(j,i) for i,j in my_dict]
lis=sorted(lis)
print(lis)
k=len(lis)-1
lis3=[]
for i in range(len(lis)-1,-1,-1):
lis2=[]
count=lis[i][0]
for j in range(len(lis)-1,-1,-1):
if count==lis[j][0]:
lis2.append(lis[j][1])
lis3.append(sorted(lis2))
lis4=[]
for i in lis3:
if i not in lis4:
lis4.append(i)
print(lis4)
k=0
for i in range(len(lis4)):
for j in range(len(lis4[i])):
print(lis4[i][j],c[lis4[i][j]])
k=k+1
if k==3:
break
if k==3:
break
comp_logo(input())