You are viewing a single comment's thread. Return to all comments →
Core Python code (Without Built-in function)- We will appreciate itertools module some other time :
string= input() lst= [element for element in string] count= 1 prev= lst[0] for i in range(1, len(lst)): if lst[i] == prev: count = count + 1 else: print(f"({count}, {prev})", end= " ") prev= lst[i] count = 1 print(f"({count}, {prev})")
Seems like cookies are disabled on this browser, please enable them to open this website
Compress the String!
You are viewing a single comment's thread. Return to all comments →
Core Python code (Without Built-in function)- We will appreciate itertools module some other time :