def operation(st): st_new = "" cnt = 0 dr = st[0] print(dr) for i in st: if i == dr: cnt +=1 else: st_new = st_new + dr + str(cnt) cnt = 1 dr = i st_new = st_new + dr + str(cnt) print(st_new) if __name__ == "__main__": st = "abcabbbccaabd" print(st) operation(st)
Nice explanation 👌 👍 👏
thoda tej bola kro ya phir use good speaker.
Noted bro
I know voice is on the little lower side
def operation(st):
st_new = ""
cnt = 0
dr = st[0]
print(dr)
for i in st:
if i == dr:
cnt +=1
else:
st_new = st_new + dr + str(cnt)
cnt = 1
dr = i
st_new = st_new + dr + str(cnt)
print(st_new)
if __name__ == "__main__":
st = "abcabbbccaabd"
print(st)
operation(st)