fork download
  1. s = input()
  2. arr = [0 for i in range(26)]
  3. cnt = 0
  4. for i in range(len(s)):
  5. if 'a'<= s[i] <= 'z':
  6. arr[ord(s[i])-97] += 1
  7. elif 'A' <= s[i] <= 'Z':
  8. arr[ord(s[i])-65] += 1
  9. max = max(arr)
  10. for i in range(26):
  11. if cnt > 1:
  12. print('?')
  13. break
  14. if arr[i] == max:
  15. cnt += 1
  16. if cnt == 1:
  17. print(chr(arr.index(max)+65))
Success #stdin #stdout 0.02s 9172KB
stdin
az
stdout
Standard output is empty