AnnaKar/abrivan
AnnaKar/eBadalyan
n1a1a2 = eval(input())n1nw = eval(input())
2d = dict()2d = dict()
3text = input()3text = input()
nn4 
4while text:5while text:
5    text = text.split()6    text = text.split()
n6    for slova in text:n7    for words in text:
7        if "'" in slova:8        if "'" in words:
8            slova = slova[0:slova.find("'")]9            words = words[0:words.find("'")]
9        if ";" in slova:10        if ";" in words:
10            slova = slova[0:slova.find(";")]11            words = words[0:words.find(";")]
11        if "-" in slova:12        if "-" in words:
12            slova = slova.replace((slova[0:slova.find("-")]+"-"), "")13            words = words.replace((words[0:words.find("-")] + "-"), "")
13        while len(slova) > 1 and not slova[-1].isalpha():14        while len(words) > 1 and not words[-1].isalpha():
14            slova = slova[0:-1]15            words = words[0:-1]
15        while len(slova) > 1 and not slova[0].isalpha():16        while len(words) > 1 and not words[0].isalpha():
16            slova = slova[1:]17            words = words[1:]
17        slova = slova.lower()18        words = words.lower()
18        if slova.isalpha() and len(slova) >= a2:19        if words.isalpha() and len(words) >= w:
19            if slova in d:20            if words in d:
20                d[slova] += 121                d[words] += 1
21            else:22            else:
n22                d[slova] = 1n23                d[words] = 1
24    text = input()
2325
t24    text = input()t
25kol_sl = set(d.values())26wordsCount = set(d.values())
26kol_sl = list(kol_sl)27wordsCount = list(wordsCount)
27kol_sl.sort(reverse=True)28wordsCount.sort(reverse=True)
28kol_sl = kol_sl[0:a1]29wordsCount = wordsCount[0:n]
29l = [(v, k) for k, v in d.items() if v in kol_sl]30l = [(v, k) for k, v in d.items() if v in wordsCount]
30l.sort()31l.sort()
31for x in l:32for x in l:
32    print(x[0], ': ', x[1], sep='')33    print(x[0], ': ', x[1], sep='')
3334
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op