output_description: Print the minimum possible length of s.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      a
      b
      c
attempt: from functools import reduce
  
  n = int(input())
  
  alphabet = "abcdefghij"
  
  cur = [[] for _ in range(10)]
  nxt = [[] for _ in range(10)]
  
  cur[0] = ["a"]
  for _ in range(1, n):
      for i in range(10):
          for x in cur[i]:
              nxt[i].extend([x + alphabet[j] for j in range(i + 1)])
              nxt[i + 1].append(x + alphabet[i + 1])
      cur = nxt.copy()
      nxt = [[] for _ in range(10)]
  ans = reduce(lambda a, b: a + b, cur)
  ans.sort()
  print(*ans, sep="\n")
  
problem_description: Statement
  
  Snuke has a string s. From this string, Anuke, Bnuke, and Cnuke obtained
  strings a, b, and c, respectively, as follows:
  
    * Choose a non-empty (contiguous) substring of s (possibly s itself). Then, replace some characters (possibly all or none) in it with `?`s.
  
  For example, if s is `mississippi`, we can choose the substring `ssissip` and
  replace its 1-st and 3-rd characters with `?` to obtain `?s?ssip`.
  
  You are given the strings a, b, and c. Find the minimum possible length of s.
samples: [{"input": "a?c\n    der\n    cod", "output": "7\n    \n\nFor example, s could be `atcoder`.\n\n* * *"}, {"input": "atcoder\n    atcoder\n    ???????", "output": "7\n    \n\na, b, and c may not be distinct."}]