結果

問題 No.2707 Bag of Words Encryption
ユーザー nomeaningnomeaning
提出日時 2024-03-31 13:35:16
言語 Rust
(1.83.0 + proconio)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 534 bytes
コンパイル時間 14,132 ms
コンパイル使用メモリ 402,024 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-09-30 18:06:44
合計ジャッジ時間 14,322 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

use std::collections::HashMap;

fn main() {
    let stdin = std::io::stdin();
    let mut line = String::new();
    stdin.read_line(&mut line).unwrap();
    let mut line = String::new();
    stdin.read_line(&mut line).unwrap();
    let line = line.trim();
    let mut counter = HashMap::new();
    for c in line.chars() {
        *counter.entry(c).or_insert(0) += 1;
    }
    let mut ret = String::new();
    for c in 'A'..='Z' {
        ret += &format!("{}", counter.get(&c).cloned().unwrap_or(0));
    }
    println!("{}", ret);
}
0