Chef and Sign Sequence: July Long 2017 Question | Please tell me If anything is wrong in this solution

Please, can anyone tell me what is wrong in this Code?
This is the question of July 2017 Long challenge. Please help!!

Click to view the problem statement

import java.util.*;
import java.io.*;

class chefsign
{
public static void main(String args[])throws IOException
{
	try
	{
		InputStreamReader is = new InputStreamReader(System.in);
		BufferedReader bf = new BufferedReader(is);
		
		int t = Integer.parseInt(bf.readLine());
		while(t>0)
		{
			String s = bf.readLine();
			int temp_num=1;
			int min=1, max=1;
			for(int i=0; i<s.length(); i++)
			{
				if(s.charAt(i)=='<')
				{
					temp_num++;
					if(temp_num>max)
						max = temp_num;
				}
				else if(s.charAt(i)=='>')
				{
					temp_num--;						
					if(temp_num<min)
						min = temp_num;
				}
			}
			System.out.println(Math.abs(max-min)+1);
			t--;
		}
	}
	catch(Exception e)
	{
		return;
	}
}

}

This isnt the absolutely correct way of finding longest consecutive block. It fails on this type of test case-

Input
1
<<<>>><<>>>>
Your Output
6
Correct Output
5

Thank you! @vijju123