• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

a guest Oct 14th, 2019 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. n=int(input())
2. arr=[]
3. shis=[]
4. nazv=[]
5. for i in range(n):
6.     arr.append(input())
7. g=arr[0]
8. k=1
9. for i in range(1,n):
10.     if arr[i]==g:
11.         k+=1
12. s=k
13. j=0
14. while s>0:
15.     if g==arr[j]:
16.         arr.pop(j)
17.         s-=1
18.         n-=1
19.     else:
20.         j+=1
21. shis.append(k)
22. nazv.append(g)
23. max=shis[0]
24. while arr!=[]:
25.     g=arr[0]
26.     k=1
27.     for i in range(1,n):
28.         if arr[i]==g:
29.             k+=1
30.     s=k
31.     j=0
32.     while s>0:
33.         if g==arr[j]:
34.             arr.pop(j)
35.             s-=1
36.             n-=1
37.         else:
38.             j+=1
39.     shis.append(k)
40.     nazv.append(g)
41.     if shis[len(shis)-1]>max:
42.         max=shis[len(shis)-1]
43.         maxz=nazv[len(nazv)-1]
44.         for i in range(len(shis)-1,0,-1):
45.             shis[i]=shis[i-1]
46.             nazv[i]=nazv[i-1]
47.         shis[0]=max
48.         nazv[0]=maxz
49. for i in range(len(shis)):
50.     print(nazv[i],shis[i])
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Not a member of Pastebin yet?