-3

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

string = aaabbcccaa 

output will be

a3b2c3a2

Aran-Fey
  • 35,525
  • 9
  • 94
  • 135
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
  • 593
  • 4
  • 10