How do i remove repeated letters in a string?
Tried this without success..
def shorten_string(char_str):
new=''
for i in range(0,len(char_str)-1):
if char_str[i-1] != char_str[i]:
new += char_str[i]
return new
EDIT: Misunderstanding: i do not want to delete all repeated characthers. Just if they are repeated in order.
input: lloolleellaa
outpu: lolela