#include using namespace std; using ll = long long; #include using namespace atcoder; using mint = modint998244353; void solve() { string S; cin >> S; stack P; for (auto s : S) { if (s == '<')P.push(0); else if (s == '>') { if (!P.empty() && P.top() > 0) { P.pop(); } else P.push(-1e9); } else { if (!P.empty() && P.top() >= 0)P.top()++; else P.push(-1e9); } } int an = P.size(); while (!P.empty()) { if (P.top() >= 0)an += P.top(); P.pop(); } cout << an << endl; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); // ll T; // cin>>T; // while(T--) solve(); }