Sample Input: d8s2b5r6
Output: dlsubgrx
string_data=input("Enter string: ")
result=''
for character in string_data:
if character.isalpha():
result=result+character
previous=character
else:
digit=int(character)
new_character=chr(ord(previous)+digit)
result=result+new_character
print("You entered: ",string_data)
print("Final result : \n", result )
No comments:
Post a Comment