fork download
  1. def main():
  2. text = str(input())
  3. result= sorted(text)
  4. count = 0
  5.  
  6. for i in range(1, len(text)):
  7. count += 1
  8. if(result[i - 1] != result[i]):
  9. print(result[i] + str(count), end='')
  10. count = 0
  11. main()
Success #stdin #stdout 0.02s 27632KB
stdin
aabb
stdout
b2