結果

問題 No.69 文字を自由に並び替え
ユーザー yamyam122
提出日時 2017-06-06 17:20:42
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 549 bytes
コンパイル時間 442 ms
コンパイル使用メモリ 57,248 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-14 06:37:37
合計ジャッジ時間 1,090 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
using namespace std;

string ReadLine(){
    string str;
    cin >> str;
    return str;
}

int main(){
    auto a =ReadLine();
    auto b =ReadLine();
    int size = a.size();
    string c(size,'0');
    
    for(int i=0;i<size; i++){
        for(int j=0; j<size; j++){
            if(a[i] == b[j]){
                c[i]=b[j];
                b[j]='\0';
                break;
            } 
        }
    }
        
    if(a==c){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}
0