Advertisement
Guest User

Untitled

a guest
Dec 2nd, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.44 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int a[2];
  4. int main()
  5. {
  6.     char s;
  7.     int t;
  8.     a[0] = 1;
  9.     cin.get(s);
  10.     while (s != '\n') {
  11.         if (s == 'A') {
  12.             t = a[0];
  13.             a[0] = a[1];
  14.             a[1] = t;
  15.         };
  16.         if (s == 'B'){
  17.             t = a[1];
  18.             a[1] = a[2];
  19.             a[2] = t;
  20.         };
  21.         if (s == 'C'){
  22.             t = a[0];
  23.             a[0] = a[2];
  24.             a[2] = t;
  25.         };
  26.         cin.get(s);
  27.     }
  28.     for (int i = 0; i <= 2; i++)
  29.         if (a[i] == 1)
  30.             cout<<(i+1)<<endl;
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement