




import itertools
import string
from collections.abc import Generator, Iterable


def 					_a							(					lowerCAmelCase    ,						lowerCAmelCase )->	Generator[tuple[str, ...], None, None]:
		SCREAMING_SNAKE_CASE_					      =							iter(lowerCAmelCase )
		while True:
				SCREAMING_SNAKE_CASE_					      =							tuple(itertools.islice(lowerCAmelCase    ,						lowerCAmelCase ) )
				if not chunk:
						return
				yield chunk


def 					_a							(					lowerCAmelCase )->	str:
		SCREAMING_SNAKE_CASE_					      =							''.join([c.upper() for c in dirty if c in string.ascii_letters] )
		SCREAMING_SNAKE_CASE_					      =							''

		if len(lowerCAmelCase ) < 2:
				return dirty

		for i in range(len(lowerCAmelCase ) - 1 ):
				clean += dirty[i]

				if dirty[i] == dirty[i + 1]:
						clean += "X"

		clean += dirty[-1]

		if len(lowerCAmelCase ) & 1:
				clean += "X"

		return clean


def 					_a							(					lowerCAmelCase )->	list[str]:
		# I and J are used interchangeably to allow
		# us to use a 5x5 table (25 letters)
		SCREAMING_SNAKE_CASE_					      =							'ABCDEFGHIKLMNOPQRSTUVWXYZ'
		# we're using a list instead of a '2d' array because it makes the math
		# for setting up the table and doing the actual encoding/decoding simpler
		SCREAMING_SNAKE_CASE_					      =							[]

		# copy key chars into the table if they are in `alphabet` ignoring duplicates
		for char in key.upper():
				if char not in table and char in alphabet:
						table.append(lowerCAmelCase )

    # fill the rest of the table in with the remaining alphabet chars
		for char in alphabet:
				if char not in table:
						table.append(lowerCAmelCase )

		return table


def 					_a							(					lowerCAmelCase    ,						lowerCAmelCase )->	str:
		SCREAMING_SNAKE_CASE_					      =							generate_table(lowerCAmelCase )
		SCREAMING_SNAKE_CASE_					      =							prepare_input(lowerCAmelCase )
		SCREAMING_SNAKE_CASE_					      =							''

		# https://en.wikipedia.org/wiki/Playfair_cipher#Description
		for chara, chara in chunker(lowerCAmelCase    ,						2 ):
				SCREAMING_SNAKE_CASE_      ,				SCREAMING_SNAKE_CASE_					      =							divmod(table.index(lowerCAmelCase )    ,						5 )
				SCREAMING_SNAKE_CASE_      ,				SCREAMING_SNAKE_CASE_					      =							divmod(table.index(lowerCAmelCase )    ,						5 )

				if rowa == rowa:
						ciphertext += table[rowa * 5 + (cola + 1) % 5]
						ciphertext += table[rowa * 5 + (cola + 1) % 5]
				elif cola == cola:
						ciphertext += table[((rowa + 1) % 5) * 5 + cola]
						ciphertext += table[((rowa + 1) % 5) * 5 + cola]
				else:  # rectangle
						ciphertext += table[rowa * 5 + cola]
						ciphertext += table[rowa * 5 + cola]

		return ciphertext




def 					_a							(					lowerCAmelCase    ,						lowerCAmelCase )->	str:
		SCREAMING_SNAKE_CASE_					      =							generate_table(lowerCAmelCase )
		SCREAMING_SNAKE_CASE_					      =							''

		# https://en.wikipedia.org/wiki/Playfair_cipher#Description
		for chara, chara in chunker(lowerCAmelCase    ,						2 ):
				SCREAMING_SNAKE_CASE_      ,				SCREAMING_SNAKE_CASE_					      =							divmod(table.index(lowerCAmelCase )    ,						5 )
				SCREAMING_SNAKE_CASE_      ,				SCREAMING_SNAKE_CASE_					      =							divmod(table.index(lowerCAmelCase )    ,						5 )

				if rowa == rowa:
						plaintext += table[rowa * 5 + (cola - 1) % 5]
						plaintext += table[rowa * 5 + (cola - 1) % 5]
				elif cola == cola:
						plaintext += table[((rowa - 1) % 5) * 5 + cola]
						plaintext += table[((rowa - 1) % 5) * 5 + cola]
				else:  # rectangle
						plaintext += table[rowa * 5 + cola]
						plaintext += table[rowa * 5 + cola]

		return plaintext





from collections import defaultdict


def 					_a							(					lowerCAmelCase    ,						lowerCAmelCase )->	bool:
		SCREAMING_SNAKE_CASE_					      =							first_str.lower().strip()
		SCREAMING_SNAKE_CASE_					      =							second_str.lower().strip()

		# Remove whitespace
		SCREAMING_SNAKE_CASE_					      =							first_str.replace(' '    ,						'' )
		SCREAMING_SNAKE_CASE_					      =							second_str.replace(' '    ,						'' )

		# Strings of different lengths are not anagrams
		if len(lowerCAmelCase ) != len(lowerCAmelCase ):
				return False

		# Default values for count should be 0
		SCREAMING_SNAKE_CASE_					      =							defaultdict(lowerCAmelCase )

		# For each character in input strings,
		# increment count in the corresponding
		for i in range(len(lowerCAmelCase ) ):
				count[first_str[i]] += 1
				count[second_str[i]] -= 1

		return all(_count == 0 for _count in count.values() )


if __name__ == "__main__":
						from doctest import testmod

						testmod()
						SCREAMING_SNAKE_CASE:     Dict									= input('''Enter the first string ''').strip()
						SCREAMING_SNAKE_CASE:     str									= input('''Enter the second string ''').strip()

						SCREAMING_SNAKE_CASE:     Optional[Any]									= check_anagrams(input_a, input_b)
						print(f"""{input_a} and {input_b} are {'' if status else 'not '}anagrams.""")