結果
| 問題 | No.2707 Bag of Words Encryption | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2024-03-31 17:17:06 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 6 ms / 2,000 ms | 
| コード長 | 451 bytes | 
| コンパイル時間 | 1,763 ms | 
| コンパイル使用メモリ | 170,604 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2024-09-30 21:09:44 | 
| 合計ジャッジ時間 | 2,372 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 15 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    string S;
    cin >> N;
    cin >> S;
    sort(S.begin(), S.end());
    string X="";
    int i=0;
    for (char ch='A'; ch<='Z'; ch++){
        int count=0;
        while (S[i]==ch){
            count++;
            i++;
        }
        string ans=to_string(count);
        for (int j=0; j<ans.size(); ++j){
            X.push_back(ans[j]);
        }
    }
    cout << X;
}
            
            
            
        