import java.util.*;
class code3{
public static void main
(String args
[]){ Scanner rea
=new Scanner
(System.
in); int t=rea.nextInt();
int[] te=new int[t];
for(int ro=0;ro<t;ro++){
//Scanner s=new Scanner(System.in);
int[] a=new int[str.length()];
for(int i=0;i<a.length;i++){
if(str.charAt(i) == '<'){
a[i]=1;
}else{
a[i]=-1;
}
}
int max=1;
int start=0,end=0,sum,st=0,en=0;
for(int i=0;i<a.length -1;i++){
start=i;
sum=0;
for(int j=i;j<a.length;j++){
sum=sum +a[j];
if(sum==0){
end=j;
}else if(sum<0){
j=a.length;
}
}
if((end-start)+1 > max ){
max=end-start;
st=start;
en=end;
i=end;
}
// System.out.println("looping "+i+" level -- start " + start + " end "+end +" max "+max);
int set;
for(set=i+1;set<a.length;set++){
if(a[set]==1){
i=set-1;
set=a.length*2;
}
}if(set==a.length){
i=a.length;
}
if(end==a.length-1){
i=a.length;
}
}
if(en == st){
te[ro]=0;
}else{
//System.out.println("start" + st + " end "+en);
te[ro]= en-st+1;
}
}
for(int result:te){
}
}
}
aW1wb3J0IGphdmEudXRpbC4qOwpjbGFzcyBjb2RlM3sKIHB1YmxpYyBzdGF0aWMgdm9pZCBtYWluKFN0cmluZyBhcmdzW10pewogIFNjYW5uZXIgcmVhPW5ldyBTY2FubmVyKFN5c3RlbS5pbik7CiAgaW50IHQ9cmVhLm5leHRJbnQoKTsKICBpbnRbXSB0ZT1uZXcgaW50W3RdOwogIGZvcihpbnQgcm89MDtybzx0O3JvKyspewogIAogIC8vU2Nhbm5lciBzPW5ldyBTY2FubmVyKFN5c3RlbS5pbik7CiAgCiAgU3RyaW5nIHN0cj1yZWEubmV4dExpbmUoKTsKICAKICAgaW50W10gYT1uZXcgaW50W3N0ci5sZW5ndGgoKV07CiAgIGZvcihpbnQgaT0wO2k8YS5sZW5ndGg7aSsrKXsKICAgICBpZihzdHIuY2hhckF0KGkpID09ICc8Jyl7CgkgIGFbaV09MTsKCSB9ZWxzZXsKCSAgYVtpXT0tMTsKCSB9CiAgI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