結果

問題 No.587 七対子
ユーザー
提出日時 2024-05-27 13:27:29
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 355 bytes
コンパイル時間 14,024 ms
コンパイル使用メモリ 402,092 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-20 20:32:10
合計ジャッジ時間 15,433 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 35
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::collections::HashMap;

fn main() {
	let mut s = String::new();
	std::io::stdin().read_line(&mut s).ok();
	let mut h = HashMap::new();
	for c in s.trim().chars() {
		let v = h.entry(c).or_insert(0);
		*v += 1;
		if *v > 2 || h.len() > 7 {
			println!("Impossible");
			return;
		}
	}
	println!("{}", h.iter().find(|&(_, &v)| v == 1).unwrap().0)
}
0