


"""simple docstring"""
from __future__ import annotations

from collections import Counter






def 						lowercase				(	_snake_case		: int	)	->list[int]:
	"""simple docstring"""





	__snake_case      :		List[str]         =							[True] * n
	__snake_case      :		str         =							False
	__snake_case      :		int         =							False
	__snake_case      :		List[str]         =							True

	for i in range(3	,  int(n**0.5 + 1	)	,  2	):
		__snake_case      :		List[Any]         =							i * 2
		while index < n:
			__snake_case      :		int         =							False
			__snake_case      :		Any         =							index + i

	__snake_case      :		Dict         =							[2]

	for i in range(3	,  _snake_case	,  2	):
		if is_prime[i]:
			primes.append(_snake_case	)

	return primes






def 						lowercase				(	_snake_case		: int	)	->list[list[int]]:
	"""simple docstring"""





	__snake_case      :		Optional[Any]         =							str(_snake_case	)
	__snake_case      :		str         =							[]
	__snake_case      :		List[Any]         =							['''0''', '''1''', '''2''', '''3''', '''4''', '''5''', '''6''', '''7''', '''8''', '''9''']

	for duplicate in Counter(_snake_case	) - Counter(set(_snake_case	)	):
		__snake_case      :		Union[str, Any]         =							[int(number_str.replace(_snake_case	,  _snake_case	)	) for digit in digits]
		replacements.append(_snake_case	)

	return replacements






def 						lowercase				(	_snake_case		: int = 8	)	->int:
	"""simple docstring"""





	__snake_case      :		Any         =							set()

	# Filter primes with less than 3 replaceable digits
	__snake_case      :		Dict         =							{
	    x for x in set(prime_sieve(1_000_000	)	) if len(str(_snake_case	)	) - len(set(str(_snake_case	)	)	) >= 3
	}

	for prime in primes:
		if prime in numbers_checked:
			continue

		__snake_case      :		Union[str, Any]         =							digit_replacements(_snake_case	)

		for family in replacements:
			numbers_checked.update(_snake_case	)
			__snake_case      :		Optional[Any]         =							primes.intersection(_snake_case	)

			if len(_snake_case	) != family_length:
				continue

			return min(_snake_case	)

	return -1


if __name__ == "__main__":
			print(solution())











'''simple docstring'''






def      __lowerCAmelCase   (       snake_case__		):
			__UpperCamelCase :     int										=  word.upper()
			__UpperCamelCase :     List[str]										=  0
			__UpperCamelCase :     int										=  {}
			__UpperCamelCase :     Tuple										=  []

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


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

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

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

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

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



