


'''simple docstring'''







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






def 			lowercase				(_A   ,						_A					):







       """simple docstring"""







       _lowerCAmelCase    :							Any   			=       iter(_A					)
       while True:
              _lowerCAmelCase    :							int   			=       tuple(itertools.islice(_A   ,						_A					)					)
              if not chunk:
                     return
              yield chunk






def 			lowercase				(_A					):







       """simple docstring"""







       _lowerCAmelCase    :							int   			=       ''.join([c.upper() for c in dirty if c in string.ascii_letters]					)
       _lowerCAmelCase    :							Tuple   			=       ''

       if len(_A					) < 2:
              return dirty

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

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

       clean += dirty[-1]

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

       return clean






def 			lowercase				(_A					):







       """simple docstring"""







       _lowerCAmelCase    :							Optional[Any]   			=       '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
       _lowerCAmelCase    :							Optional[int]   			=       []

       # 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(_A					)

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

       return table






def 			lowercase				(_A   ,						_A					):







       """simple docstring"""







       _lowerCAmelCase    :							int   			=       generate_table(_A					)
       _lowerCAmelCase    :							Optional[int]   			=       prepare_input(_A					)
       _lowerCAmelCase    :							Tuple   			=       ''

       # https://en.wikipedia.org/wiki/Playfair_cipher#Description
       for chara, chara in chunker(_A   ,						2					):
              _lowerCAmelCase    :							List[Any]   			=       divmod(table.index(_A					)   ,						5					)
              _lowerCAmelCase    :							Tuple   			=       divmod(table.index(_A					)   ,						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 			lowercase				(_A   ,						_A					):







       """simple docstring"""







       _lowerCAmelCase    :							List[Any]   			=       generate_table(_A					)
       _lowerCAmelCase    :							Optional[Any]   			=       ''

       # https://en.wikipedia.org/wiki/Playfair_cipher#Description
       for chara, chara in chunker(_A   ,						2					):
              _lowerCAmelCase    :							Any   			=       divmod(table.index(_A					)   ,						5					)
              _lowerCAmelCase    :							int   			=       divmod(table.index(_A					)   ,						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





'''simple docstring'''







from collections import Counter
from timeit import timeit






def 			lowercase				(_A = ""   ,						):







       """simple docstring"""







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






def 			lowercase				(_A = ""					):







       """simple docstring"""







       if len(_A					) == 0:
              return True
       _lowerCAmelCase    :							Union[str, Any]   			=       input_str.replace(' '   ,						''					).lower()
       # character_freq_dict: Stores the frequency of every character in the input string
       _lowerCAmelCase    :							dict[str, int]   			=       {}

       for character in lower_case_input_str:
              _lowerCAmelCase    :							Union[str, Any]   			=       character_freq_dict.get(_A   ,						0					) + 1
       _lowerCAmelCase    :							List[Any]   			=       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 			lowercase				(_A = ""					):







       """simple docstring"""







       print('\nFor string = '   ,						_A   ,						':'					)
       print(
           '> can_string_be_rearranged_as_palindrome_counter()'   ,						'\tans ='   ,						can_string_be_rearranged_as_palindrome_counter(_A					)   ,						'\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(_A					)   ,						'\ttime ='   ,						timeit(
               'z.can_string_be_rearranged_as_palindrome(z.check_str)'   ,						setup='import __main__ as z'   ,						)   ,						'seconds'   ,						)


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

