Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define IAMSPEED ios_base::sync_with_stdio(0);cin.tie(0);
  4.  
  5. int main() {
  6. IAMSPEED
  7. int tc;
  8. cin >> tc;
  9. while (tc--) {
  10. string s;
  11. cin >> s;
  12. map<pair<int,int>,int> mp;
  13. pair<int,int> cur(0,0);
  14. int left = 0, right = 0;
  15. for (int i = 0; i < (int)s.size(); ++i) {
  16. if (s[i]=='U') ++cur.second;
  17. if (s[i]=='D') --cur.second;
  18. if (s[i]=='R') ++cur.first;
  19. if (s[i]=='L') --cur.first;
  20.  
  21. }
  22. }
  23.  
  24. return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement