#include using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { string s; cin >> s; stack> st; for (char c : s) { bool flag = false; if (st.size() >= 2) { auto [c1, cnt1] = st.top(); st.pop(); auto [c2, cnt2] = st.top(); st.pop(); if (c2 == '<' && c1 == '=' && c == '>') { flag = true; } else { st.push({ c2, cnt2 }); st.push({ c1, cnt1 }); } } if (!flag) { if (c == '=' && !st.empty() && st.top().first == '=') { st.top().second++; } else { st.push({ c, 1 }); } } Debug(st); } int ans = 0; while (!st.empty()) { auto [c, cnt] = st.top(); st.pop(); ans += cnt; } cout << ans << endl; return 0; }