




def 					_a							(					lowerCAmelCase )->	List[str]:
		SCREAMING_SNAKE_CASE_					      =							0
		SCREAMING_SNAKE_CASE_					      =							len(lowerCAmelCase )

		for i in range(n - 1 ):
				for j in range(i + 1    ,						lowerCAmelCase ):
						if arr[i] > arr[j]:
								num_inversions += 1

		return num_inversions


def 					_a							(					lowerCAmelCase )->	Any:
		if len(lowerCAmelCase ) <= 1:
				return arr, 0
		SCREAMING_SNAKE_CASE_					      =							len(lowerCAmelCase ) // 2
		SCREAMING_SNAKE_CASE_					      =							arr[0:mid]
		SCREAMING_SNAKE_CASE_					      =							arr[mid:]

		SCREAMING_SNAKE_CASE_      ,				SCREAMING_SNAKE_CASE_					      =							count_inversions_recursive(lowerCAmelCase )
		SCREAMING_SNAKE_CASE_      ,				SCREAMING_SNAKE_CASE_					      =							count_inversions_recursive(lowerCAmelCase )
		SCREAMING_SNAKE_CASE_      ,				SCREAMING_SNAKE_CASE_					      =							_count_cross_inversions(lowerCAmelCase    ,						lowerCAmelCase )

		SCREAMING_SNAKE_CASE_					      =							inversion_p + inversions_q + cross_inversions
		return c, num_inversions


def 					_a							(					lowerCAmelCase    ,						lowerCAmelCase )->	List[Any]:
		SCREAMING_SNAKE_CASE_					      =							[]
		SCREAMING_SNAKE_CASE_					      =							SCREAMING_SNAKE_CASE_					      =							SCREAMING_SNAKE_CASE_					      =							0
		while i < len(lowerCAmelCase ) and j < len(lowerCAmelCase ):
				if p[i] > q[j]:
						# if P[1] > Q[j], then P[k] > Q[k] for all  i < k <= len(P)
						# These are all inversions. The claim emerges from the
						# property that P is sorted.
						num_inversion += len(lowerCAmelCase ) - i
						r.append(q[j] )
						j += 1
				else:
						r.append(p[i] )
						i += 1

		if i < len(lowerCAmelCase ):
				r.extend(p[i:] )
		else:
				r.extend(q[j:] )

		return r, num_inversion


def 					_a							(					)->	Union[str, Any]:
		SCREAMING_SNAKE_CASE_					      =							[10, 2, 1, 5, 5, 2, 11]

		# this arr has 8 inversions:
		# (10, 2), (10, 1), (10, 5), (10, 5), (10, 2), (2, 1), (5, 2), (5, 2)

		SCREAMING_SNAKE_CASE_					      =							count_inversions_bf(lowerCAmelCase )
		SCREAMING_SNAKE_CASE_      ,				SCREAMING_SNAKE_CASE_					      =							count_inversions_recursive(lowerCAmelCase )

		assert num_inversions_bf == num_inversions_recursive == 8

		print('number of inversions = '    ,						lowerCAmelCase )

		# testing an array with zero inversion (a sorted arr_1)

		arr_a.sort()
		SCREAMING_SNAKE_CASE_					      =							count_inversions_bf(lowerCAmelCase )
		SCREAMING_SNAKE_CASE_      ,				SCREAMING_SNAKE_CASE_					      =							count_inversions_recursive(lowerCAmelCase )

		assert num_inversions_bf == num_inversions_recursive == 0
		print('number of inversions = '    ,						lowerCAmelCase )

		# an empty list should also have zero inversions
		SCREAMING_SNAKE_CASE_					      =							[]
		SCREAMING_SNAKE_CASE_					      =							count_inversions_bf(lowerCAmelCase )
		SCREAMING_SNAKE_CASE_      ,				SCREAMING_SNAKE_CASE_					      =							count_inversions_recursive(lowerCAmelCase )

		assert num_inversions_bf == num_inversions_recursive == 0
		print('number of inversions = '    ,						lowerCAmelCase )


if __name__ == "__main__":
						main()





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.""")