use bufio; use fmt; use io; use os; fn scanbyte(file: io::handle) u8 = { match (bufio::scanbyte(os::stdin)!) { case let byte: u8 => return byte; case io::EOF => fmt::fatal("Unexpected EOF"); }; }; export fn main() void = { let score: u16 = 0; for (true) { const opponent = match (bufio::scanbyte(os::stdin)!) { case let byte: u8 => yield byte; case io::EOF => break; } - '?'; scanbyte(os::stdin); const outcome = scanbyte(os::stdin) - 'X'; scanbyte(os::stdin); score += (opponent + outcome) % 3 + 1 + outcome * 3; }; fmt::println(score)!; };