Problem:
Score : 100 points

Problem Statement

AtCoder Inc. holds a contest every Saturday.

There are two types of contests called ABC and ARC, and just one of them is held at a time.

The company holds these two types of contests alternately: an ARC follows an ABC and vice versa.

Given a string S representing the type of the contest held last week, print the string representing the type of the contest held this week.

Constraints

S is ABC or ARC.

Input

Input is given from Standard Input in the following format:

S

Output

Print the string representing the type of the contest held this week.

Sample Input 1

ABC

Sample Output 1

ARC

They held an ABC last week, so they will hold an ARC this week.

Solution in Rust (1.42.0) (judge verdict: Accepted)

use input::{Input, ReadMode};

fn main() {
    let mut input = Input::new(ReadMode::Line);

    let s = input.parse::<String>().chars().collect::<Vec<_>>();
    if s[1] == 'B' {
        println!("ARC");
    } else {
        println!("ABC");
    }
}

#[allow(dead_code)]
pub mod input {
    use std::io::{BufRead, Read};

    pub enum ReadMode {
        Full,
        Line,
    }

    pub struct Input<'a> {
        lock: std::io::StdinLock<'static>,
        iter: Option<std::str::SplitAsciiWhitespace<'a>>,
        mode: ReadMode,
    }

    impl<'a> Input<'a> {
        fn naive_read(&mut self) -> Option<std::str::SplitAsciiWhitespace<'a>> {
            let mut s = Box::leak(Box::new(String::new()));
            let res = match self.mode {
                ReadMode::Full => self.lock.read_to_string(&mut s),
                ReadMode::Line => self.lock.read_line(&mut s),
            };
            res.ok().expect("failed to read");
            Some(s.split_ascii_whitespace())
        }
        pub fn new(mode: ReadMode) -> Self {
            let lock = Box::leak(Box::new(std::io::stdin())).lock();
            let iter = None;
            Self { lock, iter, mode }
        }
        pub fn read_line(&mut self) -> String {
            let mut s = String::new();
            self.lock.read_line(&mut s).ok().expect("failed to read");
            s
        }
        pub fn parse<T: std::str::FromStr>(&mut self) -> T {
            match &mut self.iter {
                Some(iter) => {
                    let x = match iter.next() {
                        Some(x) => x,
                        None => {
                            self.iter = self.naive_read();
                            self.iter.as_mut().unwrap().next().expect("reached EOF")
                        }
                    };
                    x.parse().ok().expect("failed to parse")
                }
                None => {
                    self.iter = self.naive_read();
                    self.parse()
                }
            }
        }
    }
}