Why my code says WA i cannot get.
Please Help
import java.io.*;
class Compiler
{
static String a[];
static int pos;
public static void main(String args[])throws Exception
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int t=Integer.parseInt(br.readLine());
for(int z=0;z<t;z++) {
a=new String[1000000];
long l=0;
pos=0;
String s=br.readLine();
for(int i=0;i<s.length();i++) {
if(s.charAt(i)=='<')push(""+s.charAt(i));
else {
if(pos>0) {
String k=pop()+">";
l=Math.max(l,k.length());
if(pos>0)a[pos-1]=a[pos-1]+k;
}
}
}
System.out.println(l);
}
}
static void push(String s) {
a[pos++]=s;
}
static String pop() {
String k=a[pos-1];
a[pos-1]=null;
pos--;
return k;
}
}