- def listToString(s):
- # initialize an empty string
- str1 = " "
- # return string
- return (str1.join(s))
- dict = {68: 'dnmjhmj', 45: 'ccccnnghjjjjjjjyey', 3: 'hjlrrrrrrrrrrrrrrwt', 21: 'a', 24: 'cbnmnbn', 97: 'mjmjujjedtjtyyt', 63: 'baaaaaaaaaaaa', 9: 'abbbssskkklllw', 59: 'djkjkjfjkfmk', 48: 'dhgjkuyfuuj', 12: 'shfnhnhn', 42: 'dyjukryejumdeyu', 69: 'abbcg', 39: 'eeettyurjiri', 23: 'shfdnjhmmk', 51: 'gtweerijklv', 55: 'dstejussnvxm', 33: 'aasssssgggw', 66: 'htttttwrtkkkkg', 75: 'jklddddddew', 78: 'fgsggggggg', 88: 'vnxcnbxdhjg', 76: 'xzsgbxsfghnyj', 64: 'ahahattttaaaaa', 15: 'yiiiuuuucc', 22: 'dhjuyyyyyyyyyyyyo', 27: 'oprtttyyowwwwddddddddk', 35: 'sghgfhsgkj', 18: 'dlggh', 57: 'wwddddgtttqqqlllo', 36: 'aaaaaaabbbbbbb', 81: 'aaaaaaab', 56: 'yhsyhjuiuopopppp', 30: 'abcgggjjkkkwwwllwwwwwwf', 19: 'vzvzvzbvxxxx', 44: 'zvbnbhnhshnghndmhgjmjh', 17: 'hdjkkkkkreaaa', 61: 'mmmmmswyhjsw', 28: 'djhfmhjm', 65: 'ejjjjjjjjjjm', 29: 'dhmnjmk', 37: 'ttttttttttwywjummmmmm', 94: 'qryuwyuutiutjdgggggggggmn', 31: 'ccccmmmfffffkr', 52: 'hshhyhtyhtyh', 6: 'nxzcsrtwryu', 34: 'asrhsytjutyjiki', 58: 'fkjjkkfjjfghj'}
- print(" Nowy słownik to : \n ", dict)
- tab = []
- tab = dict.items()
- tab2 = [*dict.values()]
- print(" Lista z wartościami słownika ",tab2)
- for i in tab2:
- a = listToString(i)
- count = 0
- maxcount = 0
- lastCharacter = ""
- longestcharacter = ""
- for ch in a:
- if (ch == lastCharacter):
- count += 1
- if (count > maxcount):
- maxcount = count
- longestcharacter = ch
- else:
- count = 1
- lastCharacter = ch
- print(i)
- print(longestcharacter)
- print(maxcount)
- print(i, " najdłuższy łańcuch znaków to ", longestcharacter, " jego długość to ", maxcount)