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 them = 'D' - (match (bufio::scanbyte(os::stdin)!) { case let byte: u8 => yield byte; case io::EOF => break; }); scanbyte(os::stdin); const us = scanbyte(os::stdin) - 'W'; scanbyte(os::stdin); score += us + (us + them) % 3 * 3; }; fmt::println(score)!; };