import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;

/**
 * Created by himanshubhardwaj on 01/04/19.
 */
public class B {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int t = Integer.parseInt(br.readLine());

        while (t-- > 0) {
            int n = Integer.parseInt(br.readLine());
            char[] str = br.readLine().toCharArray();


            LinkedList<Character> list = new LinkedList<Character>();

            for (int i = 0; i < str.length; i++) {
                list.addLast(new Character(str[i]));
            }

            //System.out.println(list);

            boolean isHet = false;

            while (!isHet) {
                isHet = true;
                int pos = -1;


                if (list.size() == 2 && list.getFirst().equals(new Character('<')) && list.getLast().equals(new Character('>'))) {
                     break;
                }

                for (int i = 1; i < list.size(); i++) {
                    if (!list.get(i).equals(list.get(0))) {
                        isHet = false;
                        pos = i;
                    }
                }
                if (!isHet) {
                    if (list.get(pos).equals(new Character('<'))) {
                        list.remove(pos - 1);
                    } else if (pos > 1) {
                        list.removeFirst();
                    }
                }
            }

            System.out.println(list.size() - 1);


        }
    }
}
