COMPILER ,can any one tell me why i am getting wrong answer?

class Codechef
{
public static void main (String[] args) {
Scanner s=new Scanner(System.in);
int t=s.nextInt();
while(t>0) {
String str=s.next();
char[]ch=str.toCharArray();
long len=ch.length;
goal(ch,len);
t–;
}

	}
	public static void goal(char ch[],long len) {
		long count=0;
		long count1=0;
		long temp=0;
	for(int i=0;i<len;i++) {
		if(ch[0]==('>')) {
			System.out.println("0");
			break;
		}
		else if(ch[i]==('<')) {
			count++;
			}
		else if(ch[i]==('>') && i != 0) {
			count--;
			 
				temp++;
			
		}
		
		if(count<0) {
		       break;
		}
		else if(count==0) {
			count1=temp;
		}
		
	}
	if(count1>=1) {
	System.out.println(count1*2);
	}

		
	}

}

@raj_2020code Format your code first as the forum software has messed it up. Refer to the following guide:

1 Like