Submission
Status:
[PPPPPPPP]
Subtask/Task Score:
{100/100}
Score: 100
User: Jame007
Problemset: สตริงซ้ำซ้ำ
Language: cpp
Time: 0.002 second
Submitted On: 2026-09-27 20:25:59
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(){
string s1, s2;
cin >> s1 >> s2;
string used = "";
for(char c : s2){
// มี c อยู่ใน s1
// และยังไม่เคยพิมพ์ c
if(find(s1.begin(), s1.end(), c) != s1.end() &&
find(used.begin(), used.end(), c) == used.end()){
cout << c << " ";
used += c;
}
}
return 0;
}