



from __future__ import annotations

from scipy.special import comb  # type: ignore

class 				snake_case__:

					"""simple docstring"""






					def __init__(							self :     List[Any]				,       SCREAMING_SNAKE_CASE :     list[tuple[float, float]]					):
								lowercase__					:   Union[str, Any]													=					list_of_points
								# Degree determines the flexibility of the curve.
								# Degree = 1 will produce a straight line.
								lowercase__					:   Dict													=					len(_A					) - 1







					def 			snake_case					(							self :     Any				,       SCREAMING_SNAKE_CASE :     float					):
								assert 0 <= t <= 1, "Time t must be between 0 and 1."
								lowercase__					:   list[float]													=					[]
								for i in range(len(self.list_of_points					)					):
											# basis function for each i
											output_values.append(
											    comb(self.degree				,       _A					) * ((1 - t) ** (self.degree - i)) * (t**i)					)
								# the basis must sum up to 1 for it to produce a valid Bezier curve.
								assert round(sum(_A					)				,       5					) == 1
								return output_values







					def 			snake_case					(							self :     Union[str, Any]				,       SCREAMING_SNAKE_CASE :     float					):
								assert 0 <= t <= 1, "Time t must be between 0 and 1."

								lowercase__					:   Optional[int]													=					self.basis_function(_A					)
								lowercase__					:   int													=					0.0
								lowercase__					:   List[Any]													=					0.0
								for i in range(len(self.list_of_points					)					):
											# For all points, sum up the product of i-th basis function and i-th point.
											x += basis_function[i] * self.list_of_points[i][0]
											y += basis_function[i] * self.list_of_points[i][1]
								return (x, y)







					def 			snake_case					(							self :     Any				,       SCREAMING_SNAKE_CASE :     float = 0.01					):
								from matplotlib import pyplot as plt  # type: ignore

								lowercase__					:   list[float]													=					[]  # x coordinates of points to plot
								lowercase__					:   list[float]													=					[]  # y coordinates of points to plot

								lowercase__					:   List[Any]													=					0.0
								while t <= 1:
											lowercase__					:   List[str]													=					self.bezier_curve_function(_A					)
											to_plot_x.append(value[0]					)
											to_plot_y.append(value[1]					)
											t += step_size

								lowercase__					:   Optional[Any]													=					[i[0] for i in self.list_of_points]
								lowercase__					:   Any													=					[i[1] for i in self.list_of_points]

								plt.plot(
								    _A				,       _A				,       color="blue"				,       label="Curve of Degree " + str(self.degree					)				,       )
								plt.scatter(_A				,       _A				,       color="red"				,       label="Control Points"					)
								plt.legend()
								plt.show()


if __name__ == "__main__":
				import doctest

				doctest.testmod()

				BezierCurve([(1, 2), (3, 5)]).plot_curve()  # degree 1
				BezierCurve([(0, 0), (5, 5), (5, 0)]).plot_curve()  # degree 2
				BezierCurve([(0, 0), (5, 5), (5, 0), (2.5, -2.5)]).plot_curve()  # degree 3









from collections import Counter
from timeit import timeit


def  __lowerCamelCase (       lowerCamelCase__ = ""					,			):

				"""simple docstring"""


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


def  __lowerCamelCase (       lowerCamelCase__ = ""						):

				"""simple docstring"""


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

				for character in lower_case_input_str:
								lowercase__					:   List[Any]													=					character_freq_dict.get(lowerCamelCase__					,			0						) + 1
				lowercase__					:   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  __lowerCamelCase (       lowerCamelCase__ = ""						):

				"""simple docstring"""


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


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




