
import os
import string
import sys


lowercase__							:							List[Any]									=			1 << 8

lowercase__							:							int									=			{
    'tab': ord("\t"),
    'newline': ord("\r"),
    'esc': 2_7,
    'up': 6_5 + ARROW_KEY_FLAG,
    'down': 6_6 + ARROW_KEY_FLAG,
    'right': 6_7 + ARROW_KEY_FLAG,
    'left': 6_8 + ARROW_KEY_FLAG,
    'mod_int': 9_1,
    'undefined': sys.maxsize,
    'interrupt': 3,
    'insert': 5_0,
    'delete': 5_1,
    'pg_up': 5_3,
    'pg_down': 5_4,
}

lowercase__							:							List[Any]									=			KEYMAP['up']
lowercase__							:							int									=			KEYMAP['left']

if sys.platform == "win32":
				lowercase__							:							str									=			[]
				lowercase__							:							List[str]									=			{
				    b'\xe0H': KEYMAP['up'] - ARROW_KEY_FLAG,
				    b'\x00H': KEYMAP['up'] - ARROW_KEY_FLAG,
				    b'\xe0P': KEYMAP['down'] - ARROW_KEY_FLAG,
				    b'\x00P': KEYMAP['down'] - ARROW_KEY_FLAG,
				    b'\xe0M': KEYMAP['right'] - ARROW_KEY_FLAG,
				    b'\x00M': KEYMAP['right'] - ARROW_KEY_FLAG,
				    b'\xe0K': KEYMAP['left'] - ARROW_KEY_FLAG,
				    b'\x00K': KEYMAP['left'] - ARROW_KEY_FLAG,
				}

for i in range(1_0):
				lowercase__							:							Dict									=			ord(str(i))




def 	A_ (							)      ->    Union[str, Any]:



						'''simple docstring'''

						if os.name == "nt":
												import msvcrt

												__UpperCamelCase       =			"mbcs"
												# Flush the keyboard buffer
												while msvcrt.kbhit():
																		msvcrt.getch()
												if len(_lowerCAmelCase ) == 0:
																		# Read the keystroke
																		__UpperCamelCase       =			msvcrt.getch()

																		# If it is a prefix char, get second part
																		if ch in (b"\x00", b"\xe0"):
																								__UpperCamelCase       =			ch + msvcrt.getch()
																								# Translate actual Win chars to bullet char types
																								try:
																														__UpperCamelCase       =			chr(WIN_KEYMAP[cha] )
																														WIN_CH_BUFFER.append(chr(KEYMAP['''mod_int'''] ) )
																														WIN_CH_BUFFER.append(_lowerCAmelCase )
																														if ord(_lowerCAmelCase ) in (
																														    KEYMAP["insert"] - 1 << 9,
																														    KEYMAP["delete"] - 1 << 9,
																														    KEYMAP["pg_up"] - 1 << 9,
																														    KEYMAP["pg_down"] - 1 << 9,
																														):
																																				WIN_CH_BUFFER.append(chr(126 ) )
																														__UpperCamelCase       =			chr(KEYMAP['''esc'''] )
																								except KeyError:
																														__UpperCamelCase       =			cha[1]
																		else:
																								__UpperCamelCase       =			ch.decode(_lowerCAmelCase )
												else:
																		__UpperCamelCase       =			WIN_CH_BUFFER.pop(0 )
						elif os.name == "posix":
												import termios
												import tty

												__UpperCamelCase       =			sys.stdin.fileno()
												__UpperCamelCase       =			termios.tcgetattr(_lowerCAmelCase )
												try:
																		tty.setraw(_lowerCAmelCase )
																		__UpperCamelCase       =			sys.stdin.read(1 )
												finally:
																		termios.tcsetattr(_lowerCAmelCase ,      termios.TCSADRAIN ,      _lowerCAmelCase )
						return ch




def 	A_ (							)      ->    Optional[int]:



						'''simple docstring'''

						__UpperCamelCase       =			get_raw_chars()
						if ord(_lowerCAmelCase ) in [KEYMAP["interrupt"], KEYMAP["newline"]]:
												return char

						elif ord(_lowerCAmelCase ) == KEYMAP["esc"]:
												__UpperCamelCase       =			get_raw_chars()
												if ord(_lowerCAmelCase ) == KEYMAP["mod_int"]:
																		__UpperCamelCase       =			get_raw_chars()
																		if ord(_lowerCAmelCase ) >= KEYMAP["arrow_begin"] - ARROW_KEY_FLAG and ord(_lowerCAmelCase ) <= KEYMAP["arrow_end"] - ARROW_KEY_FLAG:
																								return chr(ord(_lowerCAmelCase ) + ARROW_KEY_FLAG )
																		else:
																								return KEYMAP["undefined"]
												else:
																		return get_raw_chars()

						else:
												if char in string.printable:
																		return char
												else:
																		return KEYMAP["undefined"]






from collections import Counter
from timeit import timeit




def 	A_ (							snake_case							:   str = "" ,      )      ->    bool:



						'''simple docstring'''

						return sum(c % 2 for c in Counter(input_str.replace(''' ''' ,      '''''' ).lower() ).values() ) < 2




def 	A_ (							snake_case							:   str = "" )      ->    bool:



						'''simple docstring'''

						if len(snake_case ) == 0:
												return True
						__UpperCamelCase       =			input_str.replace(''' ''' ,      '''''' ).lower()
						# character_freq_dict: Stores the frequency of every character in the input string
						__UpperCamelCase       =			{}

						for character in lower_case_input_str:
												__UpperCamelCase       =			character_freq_dict.get(snake_case ,      0 ) + 1
						__UpperCamelCase       =			0

						for character_count in character_freq_dict.values():
												if character_count % 2:
																		odd_char += 1
						if odd_char > 1:
												return False
						return True




def 	A_ (							snake_case							:   str = "" )      ->    None:



						'''simple docstring'''

						print('''\nFor string = ''' ,      snake_case ,      ''':''' )
						print(
						    '''> can_string_be_rearranged_as_palindrome_counter()''' ,      '''\tans =''' ,      can_string_be_rearranged_as_palindrome_counter(snake_case ) ,      '''\ttime =''' ,      timeit(
						        '''z.can_string_be_rearranged_as_palindrome_counter(z.check_str)''' ,      setup='''import __main__ as z''' ,      ) ,      '''seconds''' ,      )
						print(
						    '''> can_string_be_rearranged_as_palindrome()''' ,      '''\tans =''' ,      can_string_be_rearranged_as_palindrome(snake_case ) ,      '''\ttime =''' ,      timeit(
						        '''z.can_string_be_rearranged_as_palindrome(z.check_str)''' ,      setup='''import __main__ as z''' ,      ) ,      '''seconds''' ,      )


if __name__ == "__main__":
				lowercase__							:							Tuple									=			input(
				    "Enter string to determine if it can be rearranged as a palindrome or not: "
				).strip()
				benchmark(check_str)
				lowercase__							:							Dict									=			can_string_be_rearranged_as_palindrome_counter(check_str)
				print(F"{check_str} can {'' if status else 'not '}be rearranged as a palindrome")




