-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrik.cpp
More file actions
38 lines (32 loc) · 780 Bytes
/
Copy pathtrik.cpp
File metadata and controls
38 lines (32 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <iostream>
#include <stdio.h>
#include <string.h>
int main() {
char n[50];
bool c[3];
std::cin >> n;
c[1] = true;
c[2] = false;
c[3] = false;
for (int i = 0; i < int(strlen(n)); i++) {
if (n[i] == 'A') {
c[0] = c[1];
c[1] = c[2];
c[2] = c[0];
}
if (n[i] == 'B') {
c[0] = c[2];
c[2] = c[3];
c[3] = c[0];
}
if (n[i] == 'C') {
c[0] = c[1];
c[1] = c[3];
c[3] = c[0];
}
}
if (c[1] == true) std::cout << 1 << "\n";
if (c[2] == true) std::cout << 2 << "\n";
if (c[3] == true) std::cout << 3 << "\n";
return 0;
}