Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <fstream>
- #include <set>
- #include <cstring>
- #include <map>
- #include <string>
- #include <utility>
- using namespace std;
- int main() {
- map<string, int> turns;
- turns.insert(pair<string, int>("NE", 1));
- turns.insert(pair<string, int>("SW", 1));
- turns.insert(pair<string, int>("ES", 1));
- turns.insert(pair<string, int>("WN", 1));
- turns.insert(pair<string, int>("EN", -1));
- turns.insert(pair<string, int>("WS", -1));
- turns.insert(pair<string, int>("SE", -1));
- turns.insert(pair<string, int>("NW", -1));
- int n;
- cin >> n;
- for (int i = 0; i < n; i++) {
- int counter = 0;
- string s;
- cin >> s;
- for (int j = 0; j < s.length() - 1; j++) {
- string a = s.substr(j, 2);
- if (turns.count(a))counter += turns[a];
- }
- if (counter > 0) cout << "CW" << endl;
- else cout << "CCW" << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement