Can someone help me... I tried following code but its giving me error on Test 6. I tried many cases its working fine for me;-;
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Scanner;
public class Q_1B_Spreadsheet { public static void main(String args[])throws IOException{ Scanner sc=new Scanner(System.in); BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); long n; n=Integer.parseInt(in.readLine()); long i; for(i=0;i<n;i++){ String s=in.readLine(); s=s+" "; char c=s.charAt(0); int j=1; long co=0,ro=0; if(c=='R' && Character.isDigit(s.charAt(1))==true){ c=s.charAt(1); while(Character.isDigit(c)==true) { long b=(long) c; b=b-48; co=co*10+b; j++; c=s.charAt(j); } j++; c=s.charAt(j); if(Character.isDigit(c)==true){ while(Character.isDigit(c)==true) { long b=(long) c; b=b-48; ro=ro*10+b; j++; c=s.charAt(j); }
}
String na="";
long a,b=0,d=0;
a=ro;
while(a != 0){
char c2;
if(a%26==0){
c2='Z';
a=a/26-1;
}
else{
c2=(char)(a%26+64);
a=a/26;
}
na=c2+na;
}
System.out.println(na+co);
}
else{
j=0;
ro=0;co=0;
String col="";
c=s.charAt(0);
while(Character.isDigit(c)==false)
{
col+=c;
j++;
c=s.charAt(j);
}
while(Character.isDigit(c)==true)
{
long b=(long) c;
b=b-48;
ro=ro*10+b;
j++;
c=s.charAt(j);
}
for(int k=0;k<col.length();k++){
char c1=col.charAt(k);
long ab=(long)c1;
ab=ab-64;
co+=co*26+ab-co;
}
System.out.println("R"+ro+"C"+co);
}
}
}}




