Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cost = 0
- initial_string = ""
- initial_list = []
- def get_all_substrings(input_string):
- length = len(input_string)
- return [input_string[i:j+1] for i in range(length) for j in range(i,length)]
- #This takes the input indefenitely
- while True:
- input_string = input("Please Enter the String")
- if input_string in set(get_all_substrings(initial_string)):
- cost+=15
- else:
- cost+=10
- initial_string = initial_string + input_string
- print(" Input string : {} \n Current String:{} \n Cost:{}".format(input_string,initial_string,cost))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement