Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- string frase;
- //vector<int> b;
- int n1, n2, a = 0, b[101], c, i = 0;
- cin >> n1;
- while (n1--)
- {
- cin >> n2;
- while (n2--)
- {
- if (i == 0) cin.ignore();
- getline(cin, frase);
- if (frase == "LEFT")
- {
- b[i] = 1;
- a--;
- }
- else if (frase == "RIGHT")
- {
- b[i] = 2;
- a++;
- }
- else
- {
- c = frase[frase.size() - 1] - 48;
- cout << c << endl;
- if (b[c] == 1) {
- b[i] = 1;
- a--;
- }
- if (b[c] == 2) {
- b[i] = 2;
- a++;
- }
- }
- i++;
- }
- cout << a << endl;
- a = 0;
- i = 0;
- //b.clear();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement