



'''simple docstring'''
class 							lowercase__			:






	class 							lowercase__			:
		lowercase__						       =    """_prev""", """_data""", """_next"""





		def __init__(				self      :       Any				,lowerCamelCase__      :       Any				,lowerCamelCase__      :       Tuple				,lowerCamelCase__      :       Union[str, Any]				):







								'''simple docstring'''
								_UpperCamelCase      :	int				       =     link_p
								_UpperCamelCase      :	Optional[Any]				       =     element
								_UpperCamelCase      :	str				       =     link_n





		def 			UpperCamelCase_						(				self      :       List[Any]				):







								'''simple docstring'''
								return (
								    F' Prev -> {self._prev is not None}, Next -> {self._next is not None}'
								)





	def __init__(				self      :       List[Any]				):







							'''simple docstring'''
							_UpperCamelCase      :	str				       =     self._Node(lowerCamelCase__				,lowerCamelCase__				,lowerCamelCase__				)
							_UpperCamelCase      :	Optional[Any]				       =     self._Node(lowerCamelCase__				,lowerCamelCase__				,lowerCamelCase__				)
							_UpperCamelCase      :	Dict				       =     self._trailer
							_UpperCamelCase      :	Optional[Any]				       =     self._header
							_UpperCamelCase      :	str				       =     0





	def __len__(				self      :       str				):







							'''simple docstring'''
							return self._size





	def 			UpperCamelCase_						(				self      :       Dict				):







							'''simple docstring'''
							return self.__len__() == 0





	def 			UpperCamelCase_						(				self      :       List[str]				,lowerCamelCase__      :       Optional[Any]				,lowerCamelCase__      :       int				,lowerCamelCase__      :       Optional[Any]				):







							'''simple docstring'''
							# Create new_node by setting it's prev.link -> header
							# setting it's next.link -> trailer
							_UpperCamelCase      :	Optional[int]				       =     self._Node(lowerCamelCase__				,lowerCamelCase__				,lowerCamelCase__				)
							_UpperCamelCase      :	Tuple				       =     new_node
							_UpperCamelCase      :	Union[str, Any]				       =     new_node
							self._size += 1
							return self





	def 			UpperCamelCase_						(				self      :       List[Any]				,lowerCamelCase__      :       Optional[int]				):







							'''simple docstring'''
							_UpperCamelCase      :	Any				       =     node._prev
							_UpperCamelCase      :	List[str]				       =     node._next

							_UpperCamelCase      :	Union[str, Any]				       =     successor
							_UpperCamelCase      :	List[Any]				       =     predecessor
							self._size -= 1
							_UpperCamelCase      :	Optional[int]				       =     node._data
							_UpperCamelCase      :	Optional[Any]				       =     None
							del node
							return temp






class 							lowercase__			(							_DoublyLinkedBase     ):





	def 			UpperCamelCase_						(				self      :       Tuple				):







							'''simple docstring'''
							if self.is_empty():
													raise Exception('List is empty'				)
							return self._header._next._data





	def 			UpperCamelCase_						(				self      :       Dict				):







							'''simple docstring'''
							if self.is_empty():
													raise Exception('List is empty'				)
							return self._trailer._prev._data





	def 			UpperCamelCase_						(				self      :       Optional[Any]				,lowerCamelCase__      :       Dict				):







							'''simple docstring'''
							return self._insert(self._header				,lowerCamelCase__				,self._header._next				)





	def 			UpperCamelCase_						(				self      :       List[str]				,lowerCamelCase__      :       List[str]				):







							'''simple docstring'''
							return self._insert(self._trailer._prev				,lowerCamelCase__				,self._trailer				)





	def 			UpperCamelCase_						(				self      :       str				):







							'''simple docstring'''
							if self.is_empty():
													raise IndexError('remove_first from empty list'				)
							return self._delete(self._header._next				)





	def 			UpperCamelCase_						(				self      :       List[str]				):







							'''simple docstring'''
							if self.is_empty():
													raise IndexError('remove_first from empty list'				)
							return self._delete(self._trailer._prev				)







'''simple docstring'''
def A__					(  UpperCAmelCase_							):
						_UpperCamelCase      :	Optional[Any]				       =     word.upper()
						_UpperCamelCase      :	Optional[Any]				       =     0
						_UpperCamelCase      :	Dict				       =     {}
						_UpperCamelCase      :	List[str]				       =     []

						for letter in word:
												if letter not in letter_nums:
																		_UpperCamelCase      :	int				       =     str(UpperCAmelCase_							)
																		next_num += 1
												word_pattern.append(letter_nums[letter]							)
						return ".".join(UpperCAmelCase_							)


if __name__ == "__main__":
					import pprint
					import time

					snake_case_				:			List[Any]						 =						time.time()
					with open('dictionary.txt') as in_file:
										snake_case_				:			Any						 =						in_file.read().splitlines()

					snake_case_				:			dict						 =						{}
					for word in word_list:
										snake_case_				:			Optional[int]						 =						get_word_pattern(word)
										if pattern in all_patterns:
															all_patterns[pattern].append(word)
										else:
															snake_case_				:			Any						 =						[word]

					with open('word_patterns.txt', 'w') as out_file:
										out_file.write(pprint.pformat(all_patterns))

					snake_case_				:			List[str]						 =						round(time.time() - start_time, 2)
					print(F"""Done!  {len(all_patterns):,} word patterns found in {total_time} seconds.""")
					# Done!  9,581 word patterns found in 0.58 seconds.


