結果

問題 No.436 ccw
ユーザー Michae'Gon
提出日時 2017-02-21 01:23:55
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 441 bytes
コンパイル時間 18,422 ms
コンパイル使用メモリ 379,104 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-30 11:48:02
合計ジャッジ時間 16,298 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

fn get_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().to_string()
}

fn main() {
    let mut c = 0;
    let mut w = 0;
    for &x in get_line().as_bytes() {
        if x == b'c' {
            c += 1;
        }
        else {
            w += 1;
        }
    }

    println!("{}",
        if c - 1 < w {
            c - 1
        }
        else {
            w
        }
    );
}
0