Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define IAMSPEED ios_base::sync_with_stdio(0);cin.tie(0);
- int main() {
- IAMSPEED
- int tc;
- cin >> tc;
- while (tc--) {
- string s;
- cin >> s;
- map<pair<int,int>,int> mp;
- pair<int,int> cur(0,0);
- int left = 0, right = 0;
- for (int i = 0; i < (int)s.size(); ++i) {
- if (s[i]=='U') ++cur.second;
- if (s[i]=='D') --cur.second;
- if (s[i]=='R') ++cur.first;
- if (s[i]=='L') --cur.first;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement