Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int a[2];
- int main()
- {
- char s;
- int t;
- a[0] = 1;
- cin.get(s);
- while (s != '\n') {
- if (s == 'A') {
- t = a[0];
- a[0] = a[1];
- a[1] = t;
- };
- if (s == 'B'){
- t = a[1];
- a[1] = a[2];
- a[2] = t;
- };
- if (s == 'C'){
- t = a[0];
- a[0] = a[2];
- a[2] = t;
- };
- cin.get(s);
- }
- for (int i = 0; i <= 2; i++)
- if (a[i] == 1)
- cout<<(i+1)<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement