public static int findStep(char[][]table,int i,int j,int k,int n, int m){

        if(i<0||i>(n-1)||j<0||j>(m-1)){
            return 0;
        }

        char c = table[i][j];
       //System.out.println("c = " + c);

       if(c=='*'){
           return 1;
       }
       else if(c=='U'){
          findStep(table,i-1,j,k, n, m);
          count++;
       }
       else if(c=='L'){
           findStep(table,i,j-1,k, n, m);
           count++;
       }
       else if(c=='D'){
           findStep(table,i+1,j,k, n, m);
           count++;
       }
       else if(c=='R'){
           findStep(table,i,j+1,k, n, m);
           count++;
       }
       return count;
    }