lines = STDIN.read.split("\n") part1 = 0 part2 = 0 input = lines.map do |line| theirs = line[0].ord - 'A'.ord ours = line[2].ord - 'X'.ord part1 += ours + 1 if ours == theirs then part1 += 3 elsif (theirs + 1) % 3 == ours then part1 += 6 end if ours == 0 then part2 += (theirs - 1) % 3 + 1 elsif ours == 1 then part2 += theirs + 3 + 1 else part2 += (theirs + 1) % 3 + 6 + 1 end end puts part1, part2