Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main ()
- {
- int t;
- cin >> t;
- while (t--) {
- string s;
- cin >> s;
- int ans = 0;
- int cnt = 0;
- for (char c : s) {
- if (c == '<') cnt++;
- else if (c == '>' && cnt) {
- ans++;
- cnt--
- }
- }
- printf("%d\n", ans);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement