

def 			UpperCAmelCase__				(			_A      : str	,      _A      : str							):





  '''simple docstring'''







  a__  =len(snake_case_							) + 1
  a__  =len(snake_case_							) + 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.
  a__  =[[0 for i in range(snake_case_							)] for j in range(snake_case_							)]

  # since string of zero length match pattern of zero length
  a__  =1

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

  # since string of zero length will match with pattern where there
  # is at least one * alternatively
  for j in range(1	,      snake_case_							):
    a__  =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	,      snake_case_							):
    for j in range(1	,      snake_case_							):
      if input_string[i - 1] == pattern[j - 1] or pattern[j - 1] == ".":
        a__  =dp[i - 1][j - 1]

      elif pattern[j - 1] == "*":
        if dp[i][j - 2] == 1:
          a__  =1
        elif pattern[j - 2] in (input_string[i - 1], "."):
          a__  =dp[i - 1][j]
        else:
          a__  =0
      else:
        a__  =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 :")

       lowerCamelCase           =					'''aab'''
       lowerCamelCase           =					'''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}""")

'''simple docstring'''

from unittest import TestCase

from datasets import Sequence, Value
from datasets.arrow_dataset import Dataset







class 				_lowercase     (				UpperCAmelCase__			):


 '''simple docstring'''






 def a					(      self   :	int							)  ->    Optional[Any]:
  return [
      {"col_1": 3, "col_2": "a"},
      {"col_1": 2, "col_2": "b"},
      {"col_1": 1, "col_2": "c"},
      {"col_1": 0, "col_2": "d"},
  ]
 def a					(      self   :	List[Any]							)  ->    Any:
  __lowerCAmelCase											=						{"""col_1""": [3, 2, 1, 0], """col_2""": ["""a""", """b""", """c""", """d"""]}
  return Dataset.from_dict(SCREAMING_SNAKE_CASE__							)
 def a					(      self   :	List[Any]							)  ->    Tuple:
  __lowerCAmelCase											=						self._create_example_records()
  __lowerCAmelCase											=						Dataset.from_list(SCREAMING_SNAKE_CASE__							)
  self.assertListEqual(dset.column_names      ,       ["""col_1""", """col_2"""]							)
  for i, r in enumerate(SCREAMING_SNAKE_CASE__							):
   self.assertDictEqual(SCREAMING_SNAKE_CASE__      ,       example_records[i]							)
 def a					(      self   :	Tuple							)  ->    List[str]:
  __lowerCAmelCase											=						self._create_example_records()
  __lowerCAmelCase											=						Dataset.from_list(SCREAMING_SNAKE_CASE__							)
  __lowerCAmelCase											=						Dataset.from_dict({k: [r[k] for r in example_records] for k in example_records[0]}							)
  self.assertEqual(dset.info      ,       dset_from_dict.info							)
 def a					(      self   :	List[str]							)  ->    List[str]:  # checks what happens with missing columns
  __lowerCAmelCase											=						[{"""col_1""": 1}, {"""col_2""": """x"""}]
  __lowerCAmelCase											=						Dataset.from_list(SCREAMING_SNAKE_CASE__							)
  self.assertDictEqual(dset[0]      ,       {"""col_1""": 1}							)
  self.assertDictEqual(dset[1]      ,       {"""col_1""": None}							)  # NB: first record is used for columns
 def a					(      self   :	Dict							)  ->    Optional[int]:  # checks if the type can be inferred from the second record
  __lowerCAmelCase											=						[{"""col_1""": []}, {"""col_1""": [1, 2]}]
  __lowerCAmelCase											=						Dataset.from_list(SCREAMING_SNAKE_CASE__							)
  self.assertEqual(dset.info.features["""col_1"""]      ,       Sequence(Value("""int64"""							)							)							)





 def a					(      self   :	Optional[Any]							)  ->    Tuple:
  __lowerCAmelCase											=						Dataset.from_list([]							)
  self.assertEqual(len(SCREAMING_SNAKE_CASE__							)      ,       0							)
  self.assertListEqual(dset.column_names      ,       []							)






