Example

Input

7
>>


Output

7
#include <iostream>
#include <string>
#include <map>
#include <vector>
using namespace std;

int main() {
    int N;
    string S;
    cin >> N >> S;
    vector<int> l(N), r(N);
    vector<int> lp, rp;
    for(int i=0; i<N; ++i) {
        if(S[i] == '>') {
            l[i] = 1;
            lp.push_back(i);
        } else {
            r[i] = 1;
            rp.push_back(i);
        }
    }
    for(int i=0; i<N-1; ++i) {
        l[i+1] += l[i];
    }
    for(int i=N-1; i>=1; --i) {
        r[i-1] += r[i];
    }
    int res = 0;
    for(int i=0; i<N; ++i) {
        if(S[i] == '>') {
            if(l[i] > r[i]) {
                int idx = l[i] - r[i] -1;
                res = max(res, N-lp[idx]);
            } else {
                int idx = r[i] - l[i];
                res = max(res, rp[rp.size()-idx-1]+1);
            }
        } else {
            if(l[i] >= r[i]) {
                int idx = l[i] - r[i];
                res = max(res, N-lp[idx]);
            } else {
                int idx = r[i] - l[i];
                res = max(res, rp[rp.size()-idx]+1);
            }
        }
    }
    cout << res << endl;
}
