#include using namespace std; using ll = long long; #ifdef LOCAL #include #define debug(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__) #else #define debug(...) (static_cast(0)) #endif int main() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); string S; cin >> S; int N = S.size(), ans = N; stack> stk; for (int i = 0; i < N; i++) { if (stk.empty()) { stk.emplace(S[i], 1); } else { if (S[i] == '=' && stk.top().first == '=') { stk.top().second++; } else { stk.emplace(S[i], 1); } } while (stk.size() >= 3) { auto [c3, cnt3] = stk.top(); stk.pop(); auto [c2, cnt2] = stk.top(); stk.pop(); auto [c1, cnt1] = stk.top(); stk.pop(); if (c1 == '<' && c2 == '=' && c3 == '>') { ans -= cnt2 + 2; } else { stk.emplace(c1, cnt1); stk.emplace(c2, cnt2); stk.emplace(c3, cnt3); break; } } } cout << ans << '\n'; }