"""simple docstring"""





def 				a_     (      _lowerCAmelCase  : str   , _lowerCAmelCase  : str     ):





       '''simple docstring'''

       lowercase__			:		List[str]       =	len(_lowerCAmelCase     ) + 1
       lowercase__			:		Any       =	len(_lowerCAmelCase     ) + 1

       # dp is a 2d matrix where dp[i][j] denotes whether prefix string of
       # length i of input_string matches with prefix string of length j of
       # given pattern.
       # "dp" stands for dynamic programming.
       lowercase__			:		List[str]       =	[[0 for i in range(_lowerCAmelCase     )] for j in range(_lowerCAmelCase     )]

       # since string of zero length match pattern of zero length
       lowercase__			:		Any       =	1

       # since pattern of zero length will never match with string of non-zero length
       for i in range(1   , _lowerCAmelCase     ):
              lowercase__			:		Tuple       =	0

       # since string of zero length will match with pattern where there
       # is at least one * alternatively
       for j in range(1   , _lowerCAmelCase     ):
              lowercase__			:		Union[str, Any]       =	dp[0][j - 2] if pattern[j - 1] == '*' else 0

       # now using bottom-up approach to find for all remaining lengths
       for i in range(1   , _lowerCAmelCase     ):
              for j in range(1   , _lowerCAmelCase     ):
                     if input_string[i - 1] == pattern[j - 1] or pattern[j - 1] == ".":
                            lowercase__			:		List[Any]       =	dp[i - 1][j - 1]

                     elif pattern[j - 1] == "*":
                            if dp[i][j - 2] == 1:
                                   lowercase__			:		Union[str, Any]       =	1
                            elif pattern[j - 2] in (input_string[i - 1], "."):
                                   lowercase__			:		Tuple       =	dp[i - 1][j]
                            else:
                                   lowercase__			:		Tuple       =	0
                     else:
                            lowercase__			:		List[Any]       =	0

       return bool(dp[-1][-1]     )


if __name__ == "__main__":
       import doctest

       doctest.testmod()
       # inputing the strings
       # input_string = input("input a string :")
       # pattern = input("input a pattern :")

       _UpperCamelCase   :						Any      =    "aab"
       _UpperCamelCase   :						int      =    "c*a*b"

       # using function to check whether given string matches the given pattern
       if match_pattern(input_string, pattern):
              print(f'''{input_string} matches the given pattern {pattern}''')
       else:
              print(f'''{input_string} does not match with the given pattern {pattern}''')


import math

import qiskit



def lowerCamelCase  (   SCREAMING_SNAKE_CASE = 1  ,			SCREAMING_SNAKE_CASE = 1  ,			SCREAMING_SNAKE_CASE = 1	):
    '''simple docstring'''







    if (
        isinstance(SCREAMING_SNAKE_CASE  ,			SCREAMING_SNAKE_CASE	)
        or isinstance(SCREAMING_SNAKE_CASE  ,			SCREAMING_SNAKE_CASE	)
        or isinstance(SCREAMING_SNAKE_CASE  ,			SCREAMING_SNAKE_CASE	)
    ):
        raise TypeError('''inputs must be integers.'''	)

    if (input_a < 0) or (input_a < 0) or (carry_in < 0):
        raise ValueError('''inputs must be positive.'''	)

    if (
        (math.floor(SCREAMING_SNAKE_CASE	) != input_a)
        or (math.floor(SCREAMING_SNAKE_CASE	) != input_a)
        or (math.floor(SCREAMING_SNAKE_CASE	) != carry_in)
    ):
        raise ValueError('''inputs must be exact integers.'''	)

    if (input_a > 2) or (input_a > 2) or (carry_in > 2):
        raise ValueError('''inputs must be less or equal to 2.'''	)

    # build registers
    __UpperCamelCase     :List[str]			  =		qiskit.QuantumRegister(4  ,			'''qr'''	)
    __UpperCamelCase     :str			  =		qiskit.ClassicalRegister(2  ,			'''cr'''	)
    # list the entries
    __UpperCamelCase     :Tuple			  =		[input_a, input_a, carry_in]

    __UpperCamelCase     :Optional[int]			  =		qiskit.QuantumCircuit(SCREAMING_SNAKE_CASE  ,			SCREAMING_SNAKE_CASE	)

    for i in range(0  ,			3	):
        if entry[i] == 2:
            quantum_circuit.h(SCREAMING_SNAKE_CASE	)  # for hadamard entries
        elif entry[i] == 1:
            quantum_circuit.x(SCREAMING_SNAKE_CASE	)  # for 1 entries
        elif entry[i] == 0:
            quantum_circuit.i(SCREAMING_SNAKE_CASE	)  # for 0 entries

    # build the circuit
    quantum_circuit.ccx(0  ,			1  ,			3	)  # ccx = toffoli gate
    quantum_circuit.cx(0  ,			1	)
    quantum_circuit.ccx(1  ,			2  ,			3	)
    quantum_circuit.cx(1  ,			2	)
    quantum_circuit.cx(0  ,			1	)

    quantum_circuit.measure([2, 3]  ,			SCREAMING_SNAKE_CASE	)  # measure the last two qbits

    __UpperCamelCase     :Optional[Any]			  =		qiskit.Aer.get_backend('''aer_simulator'''	)
    __UpperCamelCase     :Tuple			  =		qiskit.execute(SCREAMING_SNAKE_CASE  ,			SCREAMING_SNAKE_CASE  ,			shots=1_000	)

    return job.result().get_counts(SCREAMING_SNAKE_CASE	)


if __name__ == "__main__":
    print(F'Total sum count for state is: {quantum_full_adder(1, 1, 1)}')





