結果

問題 No.436 ccw
ユーザー hebiyan
提出日時 2017-05-23 01:05:26
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 335 bytes
コンパイル時間 11,806 ms
コンパイル使用メモリ 401,628 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-19 10:34:40
合計ジャッジ時間 13,140 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #

fn getline() -> String {
    let mut s = String::new();

    std::io::stdin().read_line(&mut s).ok();

    s.trim().to_string()
}

fn main() {
    let s = getline();

    let nc = s.chars().filter(|&c| c == 'c').count();
    let nw = s.len() - nc;

    println!("{}", if nc - 1 < nw {
        nc - 1
    } else {
        nw
    });
}
0