Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- predefined_string = input()
- password = predefined_string
- while True:
- data = input().split()
- action = data[0]
- if action == "Done":
- break
- if action == "TakeOdd":
- new_password = ""
- for index in range(len(password)):
- if index % 2 != 0:
- new_password += password[index]
- password = new_password
- print(password)
- elif action == "Cut":
- index = int(data[1])
- length = int(data[2])
- substring = password[index:(index + length)]
- if substring in password:
- password = password.replace(substring, '', 1)
- print(password)
- elif action == "Substitute":
- substring = data[1]
- substitute = data[2]
- if substring not in password:
- print('Nothing to replace!')
- else:
- password = password.replace(substring, substitute)
- print(password)
- print(f"Your password is: {password}")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement