Submission
Status:
[PPPPPPPP]
Subtask/Task Score:
{100/100}
Score: 100
User: sakurajima
Problemset: สตริงซ้ำซ้ำ
Language: cpp
Time: 0.003 second
Submitted On: 2026-09-22 21:26:41
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
string s1, s2;
cin >> s1 >> s2;
bool found[256] = {};
bool printed[256] = {};
for (int i = 0; i < s1.size(); i++) {
found[s1[i]] = true;
}
for (int i = 0; i < s2.size(); i++) {
if (found[s2[i]] == true && printed[s2[i]] == false) {
cout << char(s2[i]) << ' ';
printed[s2[i]] = true;
}
}
}