#include #include using namespace std; using ll = long long; #define rep(i, s, t) for (ll i = s; i < (ll)(t); i++) template bool chmin(T &x, T y) { return x > y ? (x = y, true) : false; } template bool chmax(T &x, T y) { return x < y ? (x = y, true) : false; } struct io_setup { io_setup() { ios::sync_with_stdio(false); std::cin.tie(nullptr); cout << fixed << setprecision(15); } } io_setup; int main(){ int n; cin>>n; string s; cin>>s; vector dp(3,0); dp.at(1)=1; rep(i,0,n){ auto ndp=dp; if(s.at(i)=='<'){ chmax(ndp.at(2),max(dp.at(0)+1,dp.at(1))); chmax(ndp.at(1),dp.at(0)+1); }else{ chmax(ndp.at(0),max(dp.at(1),dp.at(2)+1)); chmax(ndp.at(1),dp.at(2)+1); } swap(ndp,dp); } cout<<*max_element(dp.begin(),dp.end())<<"\n"; }