Submission
Status:
[PPPPPPPP]
Subtask/Task Score:
{100/100}
Score: 100
User: Newton4566
Problemset: สตริงซ้ำซ้ำ
Language: cpp
Time: 0.002 second
Submitted On: 2026-09-24 18:18:09
#include <iostream>
#include <string>
using namespace std;
int main() {
string a, b;
getline(cin, a);
getline(cin, b);
bool used[256] = {false};
bool first = true;
for (char c : a) {
if (b.find(c) != string::npos && !used[c]) {
used[c] = true;
if (!first) {
cout << ' ';
}
cout << c;
first = false;
}
}
cout << endl;
return 0;
}