public void solve() throws IOException {
    int n = nextInt();
    int m = nextInt();
    arr = new char[n][m];
    count = new int[n][m];
    for (int x = 0; x < n; x++)
      arr[x] = nextLine().toCharArray();
    int max = 0;
    for (int x = 0; x < n; x++)
      for (int y = 0; y < m; y++)
        if (arr[x][y] == 'D')
          max = recurse(x, y, nextLetter('D'));
    System.out.println(max);
  }