PY
py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
s=input('Entered string==> ')
print(s)
count={}
j=1
for i in range (0,len(s)):
if i==0:
count[j]=s[i]
else:
if s[i]==s[i-1]:
count[j]+=s[i]
else:
j+=1
count[j]=s[i]
for i in range(1, len(count)+1):
print(i, '==>', count[i])
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run