Advertisement
juneba

Untitled

Jul 25th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main ()
  6. {
  7. int t;
  8. cin >> t;
  9.  
  10. while (t--) {
  11. string s;
  12. cin >> s;
  13.  
  14. int ans = 0;
  15. int cnt = 0;
  16. for (char c : s) {
  17. if (c == '<') cnt++;
  18. else if (c == '>' && cnt) {
  19. ans++;
  20. cnt--
  21. }
  22. }
  23.  
  24. printf("%d\n", ans);
  25. }
  26.  
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement