fork(7) download
  1. tests=int(input())
  2. counter=1
  3. LetterList=[]
  4. SenList=[]
  5. while counter<=tests:
  6. Sentence=input()
  7.  
  8. SenList.append(Sentence)
  9. counter+=1
  10. counter=1
  11.  
  12. text=''
  13. for S in range(len(SenList)):
  14. text+=SenList[S]
  15. wordList=text.split()
  16. for i in range(len(wordList)):
  17. word=wordList[i]
  18. splitted=[]
  19. for let in word:
  20. splitted.append(let)
  21.  
  22. for letter in splitted:
  23. if letter not in LetterList:
  24. LetterList.append(letter)
  25. LetterList.append(1)
  26. else:
  27. for j in range(len(LetterList)-1):
  28. if letter==LetterList[j]:
  29. indeks=j
  30. howMany=LetterList[j+1]
  31. howMany+=1
  32. LetterList[j+1]=howMany
  33.  
  34. alphabet='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
  35. times=0
  36. for lett in alphabet:
  37. for which in range(len(LetterList)-1):
  38. if lett==LetterList[which]:
  39. index=which
  40. number=which+1
  41. print(str(LetterList[index])+' '+(str(LetterList[number])))
  42.  
  43.  
  44.  
  45.  
  46.  
Success #stdin #stdout 0.04s 9524KB
stdin
2
add
fsfa
stdout
a 2
d 2
f 2
s 1