output_description: Print the answer, with space in between.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      S T
      A B
      U
attempt: import copy
  
  n = input()
  k = int(input())
  
  n_list = []
  for a in n:
      n_list.append(int(a))
  n_num = len(n_list)
  
  dp = [[0] * 2 for _ in range(n_num)]
  dp[0][0] = 1
  for i in range(n_num):
      nxt = [[0] * 2 for _ in range(n_num + 1)]
      for j in range(n_num):
          for l in range(2):
              lim = 9 if l else n_list[i]
              for x in range(lim + 1):
                  if x != 0:
                      ns = j + 1
                  else:
                      ns = j
                  nlt = l | (x < n_list[i])
                  nxt[ns][nlt] += dp[j][l]
      dp = copy.deepcopy(nxt)
  ans = dp[k][0] + dp[k][1]
  print(ans)
  
problem_description: Statement
  
  We have A balls with the string S written on each of them and B balls with the
  string T written on each of them.  
  From these balls, Takahashi chooses one with the string U written on it and
  throws it away.  
  Find the number of balls with the string S and balls with the string T that we
  have now.
samples: [{"input": "red blue\n    3 4\n    red", "output": "2 4\n    \n\nTakahashi chose a ball with `red` written on it and threw it away. Now we have\ntwo balls with the string S and four balls with the string T.\n\n* * *"}, {"input": "red blue\n    5 5\n    blue", "output": "5 4\n    \n\nTakahashi chose a ball with `blue` written on it and threw it away. Now we\nhave five balls with the string S and four balls with the string T."}]