#include using namespace std; #define debug(x) cerr << #x << " = " << (x) << endl #define all(a) (a).begin(), (a).end() #define rall(a) (a).rbegin(), (a).rend() #define mp make_pair #define pb push_back typedef long long ll; typedef long double ld; typedef pair Pii; typedef pair Pll; struct IOSetup { IOSetup() { cin.tie(nullptr)->sync_with_stdio(false); cout << fixed << setprecision(16); cerr << fixed << setprecision(16); } } iosetup; template ostream &operator <<(ostream &os, const pair &p) { os << p.first << " " << p.second; return os; } template istream &operator >>(istream &is, pair &p) { is >> p.first >> p.second; return is; } template ostream &operator <<(ostream &os, const vector &v) { for(int i = 0; i < (int) v.size(); i++) os << v[i] << (i+1 == (int) v.size() ? "" : " "); return os; } template istream &operator >>(istream &is, vector &v) { for(int i = 0; i < (int) v.size(); i++) is >> v[i]; return is; } template bool chmax(T &a, const T &b) { if(a < b) { a = b; return true; } return false; } template bool chmin(T &a, const T &b) { if(a > b) { a = b; return true; } return false; } //////////////////////////////////////////////////////// int main() { string S; cin >> S; stack st; for(char c : S) { if(c == '=') { if(!st.empty() && st.top().first == 1) st.top().second++; else st.push({1, 1}); } else if(c == '<') { st.push({0, 1}); } else { if(st.empty() || st.top().first != 1) st.push({2, 1}); else { Pii tmp = st.top(); st.pop(); if(!st.empty() && st.top().first == 0) { st.pop(); } else st.push(tmp), st.push({2, 1}); } } } int ans = 0; while(!st.empty()) { ans += st.top().second; st.pop(); } cout << ans << endl; return 0; }