# coding:iso-8859-9 Trke

from collections import *

dizge = "Bu fonksiyon verili dizge ierik karakterlerinin tekrar saysn karakter-tekrar ifti olarak ilk-rastlanan srada ierir."
sayar = Counter (dizge)

print ("sayar=Counter(dizge):", sayar)

print ("\nlist(sayar.items()):", list (sayar.items()) )
print ("\nlist(sayar.keys()):", list (sayar.keys()) )
print ("\nlist(sayar.values()):", list (sayar.values()) )
print ("\nsayar['a']:", sayar['a'] )
print ("sayar[' ']:", sayar[' '] )
print ("sayar['-']:", sayar['-'] )
print ("sayar['.']:", sayar['.'] )
#----------------------------------------------------------------------------------------------

L = list (sayar.items() )
print ("\nDizge = [", dizge, "]", sep="")
print ("\nCounter anahtar:deer ifti dkm:")
for i in range (len (L) ): print (L[i][0], ":", L[i][1], sep="", end=" ")
#----------------------------------------------------------------------------------------------

print ("\n\nAzalan rastlanma sklyla dkm:", sayar.most_common() )
print ("\nArtan rastlanma sklyla dkm:", sayar.most_common()[::-1] )
print ("\nEn sk rastlanan 3 karakter azalan srada:", sayar.most_common (3) )
print ("\nEn sk rastlanan 3 karakter artan srada:", sayar.most_common (3)[::-1] )
print ("\nEn az rastlanan 3 karakter azalan srada:", sayar.most_common()[-3:] )
print ("\nEn az rastlanan 3 karakter artan srada:", sayar.most_common()[:-4:-1] )
