Submission

Status:

[PP-SSSSS]

Subtask/Task Score:

{0/100}

Score: 0

User: MyYammGods

Problemset: สตริงซ้ำซ้ำ

Language: cpp

Time: 0.002 second

Submitted On: 2025-10-07 15:13:20

#include <bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    string word1,word2;
    int count[65]={0};
    cin >> word1 >> word2;
    //if(word1.size()<word2.size()){
        for(int i=0;i<word1.length();i++){
            for(int j=0;j<word2.length();j++){
                if(word1[i]==word2[j]&&count[word2[i]-'A']==0){
                    cout << word1[i] << " ";
                    count[word1[i]-'A']=1;
                }
            }
        }
    //}
    /*else{
        for(int i=0;i<word2.length();i++){
            for(int j=0;j<word1.length();j++){
                if(word1[i]==word2[j]&&count[word1[i]-'A']==0){
                    cout << word2[i] << " ";
                    count[word2[i]-'A']=1;
                }
            }
        }
    }*/
}