#include #include using namespace std; using namespace atcoder; #define all(x) (x).begin(), (x).end() #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rrep(i, n) for(int i = (int)(n - 1); i >= 0; i--) template bool chmax(T &a,const T &b){if(a bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;} using ll = long long; #define int ll using vi = vector; using vvi = vector>; using vb = vector; using vvb = vector>; using vs = vector; using pii = pair; // using mint = modint!!!number!!!; signed main(){ string s; cin >> s; int n = size(s); deque q; vb ok(n, false); rep(i, n){ if(s.at(i) == '<'){ q.push_back(s.at(i)); ok.at(i) = true; } else if(s.at(i) == '>'){ if(!q.empty() && ok.at(i - 1) && q.back() == '='){ int cnt = 1; while(q.back() == '='){ q.pop_back(); cnt++; } q.pop_back(); ok.at(i) = ok.at(i - cnt); } else{ q.push_back(s.at(i)); ok.at(i) = false; } } else{ q.push_back(s.at(i)); ok.at(i) = (i == 0 ? false : ok.at(i - 1)); } } cout << q.size() << endl; /* while(!q.empty()){ cerr << q.front(); q.pop_front(); } */ }