




"""simple docstring"""




import qiskit
from qiskit.providers import Backend







def       __UpperCAmelCase      (				__UpperCamelCase					,							__UpperCamelCase					):






			"""simple docstring"""




			__lowercase	,__lowercase	:       str				=   bin(lowerCamelCase_					)[2:], bin(lowerCamelCase_					)[2:]  # Remove leading '0b'

			# Ensure that both strings are of the same length
			if len(lowerCamelCase_					) > len(lowerCamelCase_					):
						__lowercase	:       Optional[int]				=   y.zfill(len(lowerCamelCase_					)					)
			else:
						__lowercase	:       Optional[Any]				=   x.zfill(len(lowerCamelCase_					)					)

			# We need (3 * number of bits in the larger number)+1 qBits
			# The second parameter is the number of classical registers, to measure the result
			__lowercase	:       Union[str, Any]				=   qiskit.QuantumCircuit((len(lowerCamelCase_					) * 3) + 1					,							len(lowerCamelCase_					) + 1					)

			# We are essentially "not-ing" the bits that are 1
			# Reversed because it's easier to perform ops on more significant bits
			for i in range(len(lowerCamelCase_					)					):
						if x[::-1][i] == "1":
									circuit.x(lowerCamelCase_					)
			for j in range(len(lowerCamelCase_					)					):
						if y[::-1][j] == "1":
									circuit.x(len(lowerCamelCase_					) + j					)

			return circuit, x, y







def       __UpperCAmelCase      (				__UpperCamelCase					,							__UpperCamelCase					,							__UpperCamelCase					,							__UpperCamelCase					,							__UpperCamelCase					,							):






			"""simple docstring"""




			circuit.ccx(lowerCamelCase_					,							lowerCamelCase_					,							lowerCamelCase_					)
			circuit.cx(lowerCamelCase_					,							lowerCamelCase_					)
			circuit.ccx(lowerCamelCase_					,							lowerCamelCase_					,							lowerCamelCase_					)
			circuit.cx(lowerCamelCase_					,							lowerCamelCase_					)
			circuit.cx(lowerCamelCase_					,							lowerCamelCase_					)







def       __UpperCAmelCase      (				__UpperCamelCase					,							__UpperCamelCase					,							__UpperCamelCase = qiskit.Aer.get_backend('''aer_simulator'''					)					,							):






			"""simple docstring"""




			if vala < 0 or vala < 0:
						raise ValueError('''Both Integers must be positive!'''					)

			# Store the Integers
			__lowercase	,__lowercase	,__lowercase	:       str				=   store_two_classics(lowerCamelCase_					,							lowerCamelCase_					)
			for i in range(len(lowerCamelCase_					)					):
						full_adder(lowerCamelCase_					,							lowerCamelCase_					,							len(lowerCamelCase_					) + i					,							len(lowerCamelCase_					) + len(lowerCamelCase_					) + i					,							len(lowerCamelCase_					) + len(lowerCamelCase_					) + i + 1					)
						circuit.barrier()  # Optional, just for aesthetics

			# Measure the resultant qBits
			for i in range(len(lowerCamelCase_					) + 1					):
						circuit.measure([(len(lowerCamelCase_					) * 2) + i]					,							[i]					)

			__lowercase	:       Optional[Any]				=   qiskit.execute(lowerCamelCase_					,							lowerCamelCase_					,							shots=1					).result()

			# The result is in binary. Convert it back to int
			return int(list(res.get_counts()					)[0]					,							2					)


if __name__ == "__main__":
			import doctest

			doctest.testmod()









"""simple docstring"""




from collections import defaultdict







def       __UpperCAmelCase      (				__UpperCamelCase					):
			__lowercase	:       defaultdict[str, int]				=   defaultdict(__UpperCamelCase					)
			# Creating a dictionary containing count of each word
			for word in sentence.split():
						occurrence[word] += 1
			return occurrence


if __name__ == "__main__":
			for word, count in word_occurrence('INPUT STRING').items():
						print(F"{word}: {count}")



