Submission
Status:
[PPPPPPPP]
Score: 100
User: Namkhing
Problemset: สตริงซ้ำซ้ำ
Language: cpp
Time: 0.003 second
Submitted On: 2025-04-10 23:31:58
#include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(nullptr)->ios_base::sync_with_stdio(false);
string a, b;
cin >> a >> b;
string ans = "";
for (char c : a) {
bool ok = false;
for (char x : b) {
if (c == x) {
ok = true;
break;
}
}
if (ok) ans.push_back(c);
}
sort(ans.begin(), ans.end());
ans.resize(unique(ans.begin(), ans.end()) - ans.begin());
for (char x : ans) cout << x << " ";
}