#include using namespace std; using ll = long long; #define rep(i,m,n) for(int i=m; i bool chmin(T& a, T b){ if(a > b){a = b; return true;} return false; } template bool chmax(T& a, T b){ if(a < b){a = b; return true;} return false; } template T gcd(T a, T b){ return a % b ? gcd(b, a % b) : b; } template T lcm(T a, T b){ return a / gcd(a, b) * b; } vector> run_length(string s){ int n = s.size(); vector> res; char pre = s[0]; int cnt = 1; rep(i, 1, n){ if(s[i] == pre){ ++cnt; }else{ res.push_back({pre, cnt}); pre = s[i], cnt = 1; } } res.push_back({pre, cnt}); return res; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); string S; cin >> S; auto rle = run_length(S); vector> stk; for(auto [c, l] : rle){ if(c != '='){ rep(i, 0, l){ stk.push_back({c, 1}); int n = stk.size(); if(n >= 3 && stk[n-3].fi == '<' && stk[n-2].fi == '=' && stk[n-1].fi == '>'){ rep(j, 0, 3) stk.pop_back(); } } }else{ stk.push_back({c, l}); } } int ans = 0; for(auto [c, l] : stk){ // rep(i, 0, l) cout << c; ans += l; } // cout << endl; cout << ans << endl; return 0; }