input: Write a function to find all paths from top left to bottom right in a grid.
  assert find_paths([['S', 'O', 'O'], ['#', 'O', 'O'], ['O', 'O', 'E']]) == [['S', 'O', 'O', 'O', 'O', 'E']]
  assert find_paths([['S', '#', 'O'], ['#', 'O', 'O'], ['O', 'O', 'E']]) == []
  assert find_paths([['S', 'O', 'O', 'O'], ['O', '#', '#', 'O'], ['O', 'O', 'O', 'O'], ['O', 'O', 'O', 'E']]) == [['S', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'E'], ['S', 'O', 'O', 'O', 'O', 'O', 'O', 'O', 'E']]
output: def find_paths(grid):
      def dfs(x, y, path):
          if x == len(grid) - 1 and y == len(grid[0]) - 1:
              paths.append(path[:])
              return
          directions = [(0, 1), (1, 0)]
          for dx, dy in directions:
              nx, ny = x + dx, y + dy
              if 0 <= nx < len(grid) and 0 <= ny < len(grid[0]) and grid[nx][ny] != '#':
                  path.append(grid[nx][ny])
                  dfs(nx, ny, path)
                  path.pop()
                  
      paths = []
      if grid[0][0] != 'S' or grid[-1][-1] != 'E':
          return paths
      dfs(0, 0, [grid[0][0]])
      return paths