-3

Can anyone help me in writing code in python for string manipulation string is

string = aaabbcccaa 

output will be

a3b2c3a2

Aran-Fey
  • 39,665
  • 11
  • 104
  • 149
Chandan
  • 31
  • 6

1 Answers1

2

Here is a tip to get you started:

1) Find the length of the string

2) Iterate over the string

3) Use a dictionary to record the count of the letters

4) Iterate over the dictionary to print the result

Hope that helps :)

sjdm
  • 591
  • 4
  • 10