Submission #3820926


Source Code Expand

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) {
    if !s.starts_with('A') {
        wa();
    }

    let v: Vec<_> = s.chars().collect();

    let mut count = 0;
    for c in &v[2..s.len()-1] {
        if *c == 'C' {
            count += 1;
        }
    }
    if count != 1 {
        wa();
    }

    count = 0;
    for c in &v {
        match *c {
            'A'..'Z' => count += 1,
            _ => ()
        }
    }

    if count != 2 {
        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 726 Byte
Status CE

Compile Error

error: expected one of `...`, `=>`, `if`, or `|`, found `..`
  --> ./Main.rs:34:16
   |
34 |             'A'..'Z' => count += 1,
   |                ^^

error: aborting due to previous error