Submission
Status:
[PPPPPPPP]
Subtask/Task Score:
{100/100}
Score: 100
User: chokun
Problemset: สตริงซ้ำซ้ำ
Language: cpp
Time: 0.004 second
Submitted On: 2026-10-07 10:14:38
#include <bits/stdc++.h>
using namespace std;
int main(){
string str1, str2;
cin >> str1 >> str2;
unordered_set <char> set2;
for(char c : str2){
set2.insert(c);
}
unordered_set <char> printed;
bool first = true;
for(char c : str1){
if(set2.count(c) && !printed.count(c)){
if(!first){
cout << " ";
}
cout << c;
printed.insert(c);
first = false;
}
}
}