1 solutions

  • 0
    @ 2023-11-1 16:00:21

    题解后面补,先放个c++的

    #include<bits/stdc++.h> 
    using namespace std;
    
    string key;
    string s;
    int ma[210];
    
    bool cmp(char a,char b){
        return ma[a]<ma[b];
    }
    int main( ){
        cin>>key>>s;
        for(int i=0;key[i];i++)
            ma[key[i]]=i;
        sort(s.begin(),s.end(),cmp);
        cout<<s<<endl;
        return 0;
    }
    

    Information

    ID
    6949
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    8
    Tags
    # Submissions
    166
    Accepted
    22
    Uploaded By