結果

問題 No.587 七対子
ユーザー cra77756176
提出日時 2022-12-17 13:47:05
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 529 bytes
コンパイル時間 12,821 ms
コンパイル使用メモリ 384,528 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-16 22:07:20
合計ジャッジ時間 14,429 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    let s: Vec<char> = s.trim().chars().collect();

    let count: Vec<usize> = ('a'..='z')
        .map(|c| s.iter().filter(|&&d| d == c).count())
        .collect();

    if count.iter().filter(|&&n| n == 2).count() == 6 {
        println!(
            "{}",
            ('a'..='z')
                .nth(count.iter().position(|&n| n == 1).unwrap())
                .unwrap()
        );
    } else {
        println!("Impossible");
    }
}
0