#include using namespace std; typedef long long ll; #define REP(i, x, y) for (auto i = (x); i < (y); i++) #define RREP(i, x, y) for (auto i = (y) - 1; (x) <= i; i--) #define ALL(x) (x).begin(), (x).end() #pragma GCC optimize("O3") int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); string S; cin >> S; int N = ssize(S); stack s; stack t; REP(i, 0, N){ if(S[i] == '<'){ s.push('<'); t.push('<'); } if(S[i] == '='){ s.push('='); } if(S[i] == '>'){ if(!s.empty() && !t.empty() && s.top() == '=' && t.top() == '<'){ while(s.top() == '='){ s.pop(); } s.pop(); t.pop(); }else{ s.push('>'); t.push('>'); } } } cout << ssize(s) << "\n"; return 0; } /* File : ~/yukicoder/midoriika_3rd/F.cpp Date : 2024/10/12 Time : 14:46:06 */