output_description: Print the letter that follows C in alphabetical order.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      C
attempt: from _collections import deque
  
  h, w = map(int, input().split())
  ls = []
  for _ in range(h):
      ls1 = []
      s = input()
      for i in range(w):
          if s[i] == ".":
              ls1.append(0)
          else:
              ls1.append(1)
      ls.append(ls1)
  
  
  def trans(a, b):
      return a * w + b
  
  
  ls2 = [[] for _ in range(h * w)]
  
  for i in range(h):
      for j in range(w):
          # check ij
          if ls[i][j] == 1:
              continue
          if 0 <= i < h and 0 <= j - 1 < w and ls[i][j - 1] == 0:
              ls2[trans(i, j)].append(trans(i, j - 1))
              # print(ls2)
          if 0 <= i + 1 < h and 0 <= j < w and ls[i + 1][j] == 0:
              ls2[trans(i, j)].append(trans(i + 1, j))
              # print(ls2)
          if 0 <= i - 1 < h and 0 <= j < w and ls[i - 1][j] == 0:
              ls2[trans(i, j)].append(trans(i - 1, j))
              # print(ls2)
          if 0 <= i < h and 0 <= j + 1 < w and ls[i][j + 1] == 0:
              ls2[trans(i, j)].append(trans(i, j + 1))
  
  
  def route(i, j):
      if i == j:
          return 0
      count = 1
      ss = deque(ls2[i])
      next = deque()
      now = i
      explored = set([i])
      while True:
          # print(now, i, j)
          if not ss:
              count += 1
              ss = next
              next = deque()
          now = ss.popleft()
          if now in explored:
              continue
          if now == j:
              # print(count)
              return count
          else:
              explored.add(now)
              next.extend(ls2[now])
  
  
  ls3 = [0] * (h * w)
  
  for i in range(h * w):
      if ls2[i] == []:
          continue
      count = 0
      for j in range(h * w):
          if ls2[j] == []:
              continue
          else:
              count = max(count, route(i, j))
      ls3[i] = count
  
  print(max(ls3))
  
problem_description: Statement
  
  Given is a lowercase English letter C that is not `z`. Print the letter that
  follows C in alphabetical order.
samples: [{"input": "a", "output": "b\n    \n\n`a` is followed by `b`.\n\n* * *"}, {"input": "y", "output": "z\n    \n\n`y` is followed by `z`."}]