#include using namespace std; int scoreFor(int their, int mine) { int outcome = (mine - their + 4) % 3; /* 0 loss, 1 draw, 2 win */ return outcome * 3 + mine + 1; } int main() { char move, res; long total1 = 0, total2 = 0; while (scanf("%c %c ", &move, &res) == 2) { move -= 'A'; res -= 'X'; if (!(0 <= move && move < 3)) throw "bad input"; if (!(0 <= res && res < 3)) throw "bad input"; int mine = (move + res - 1 + 3) % 3; total1 += scoreFor(move, res); total2 += scoreFor(move, mine); } printf("%ld\n", total1); printf("%ld\n", total2); }