Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dictionary = [] # Renamed x and all references to it to dictionary for readability
- queries = [] # Renamed y and all references to it to queries for readability
- printer = []
- n = 0
- while n != "XXXXXX":
- n = input()
- if n != "XXXXXX":
- dictionary.append(n)
- n = 0
- while n != "XXXXXX":
- n = input()
- if n != "XXXXXX":
- queries.append(n)
- dict_copy = dictionary.copy()
- dictionary.sort()
- dict_copy.sort()
- i = 0
- while i < len(dictionary):
- # dictionary[i] = ''.join(sorted(set(dictionary[i])))
- dictionary[i] = ''.join(sorted(list(dictionary[i])))
- i += 1 # Restated increment statement
- i = 0
- while i < len(queries):
- # queries[i] = ''.join(sorted(set(queries[i])))
- queries[i] = ''.join(sorted(list(queries[i])))
- i = i + 1
- query_index = 0 # Renamed i to query_index for readability
- while query_index < len(queries):
- dict_index = 0 # Renamed q to query_index for readability
- while dict_index < len(dictionary):
- if queries[query_index] == dictionary[dict_index]:
- printer.append(dict_copy[dict_index])
- dict_index += 1 # Restated increment statement for dict_index
- printer.append("******")
- i += 1 # Restated increment statement
- for g in range(len(printer) - 1):
- if printer[g] == printer[g + 1]:
- printer.insert(g + 1, "NOT A VALID WORD")
- i = 0
- while i < len(printer):
- print(printer[i])
- i += 1 # Restated increment statement
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement