

def 						UpperCamelCase_(			snake_case__:  str   )       -> str:
 UpperCAmelCase__							=				word.upper()
 UpperCAmelCase__							=				0
 UpperCAmelCase__							=				{}
 UpperCAmelCase__							=				[]

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


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

 _UpperCamelCase			       =			time.time()
 with open('''dictionary.txt''') as in_file:
  _UpperCamelCase			       =			in_file.read().splitlines()

 _UpperCamelCase			       =			{}
 for word in word_list:
  _UpperCamelCase			       =			get_word_pattern(word)
  if pattern in all_patterns:
   all_patterns[pattern].append(word)
  else:
   _UpperCamelCase			       =			[word]

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

 _UpperCamelCase			       =			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.






def 						UpperCamelCase_(			snake_case__:  list   )       -> list:
 UpperCAmelCase__							=				len(snake_case__   )

 # Set the gap value to be decreased by a factor of 1.3
 # after each iteration
 UpperCAmelCase__							=				1.3

 # Continue sorting until the gap is 1
 while gap > 1:
  # Decrease the gap value
  UpperCAmelCase__							=				int(gap / shrink   )

  # Sort the elements using insertion sort
  for i in range(snake_case__  ,    len(snake_case__   )   ):
   UpperCAmelCase__							=				collection[i]
   UpperCAmelCase__							=				i
   while j >= gap and collection[j - gap] > temp:
    UpperCAmelCase__							=				collection[j - gap]
    j -= gap
   UpperCAmelCase__							=				temp

 return collection


if __name__ == "__main__":
 import doctest

 doctest.testmod()



