Submission #3820901


Source Code Expand

#![feature(exclusive_range_pattern)]
use std::io;

fn read_input() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s);
    s
}

fn wa() {
    println!("WA");
    std::process::exit(0);
}

fn solve(s: String) {
    let mut c = 0;
    for (i, j) in s.chars().enumerate() {
        match (i, j) {
            (0, 'A') => continue,
            (0, _) => wa(),
            (1, 'A'..'Z') => wa(),
            (i, 'A') => wa(),
            (i, 'B') => wa(),
            (i, 'D'..'Z') => wa(),
            (i, 'C') if i == 1 || i >= s.len() - 2 || c == 1  => wa(),
            (i, 'C') => c += 1,
            (_, _) => continue,
        }
    }
    if c == 0 {
        wa();
    }
    println!("AC");
}

fn main() {
    solve(read_input());
}

Submission Info

Submission Time
Task B - AcCepted
User knium_
Language Rust (1.15.1)
Score 0
Code Size 799 Byte
Status CE

Compile Error

error: expected one of `)`, `,`, or `...`, found `..`
  --> ./Main.rs:21:20
   |
21 |             (1, 'A'..'Z') => wa(),
   |                    ^^

error[E0554]: #[feature] may not be used on the stable release channel
 --> ./Main.rs:1:1
  |
1 | #![feature(exclusive_range_pattern)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error