Submission
Status:
[PPPPPPPP]
Subtask/Task Score:
{100/100}
Score: 100
User: purihorharin
Problemset: สตริงซ้ำซ้ำ
Language: cpp
Time: 0.002 second
Submitted On: 2026-03-20 19:04:07
#include <iostream>
#include <algorithm>
using namespace std;
int main () {
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
string a, b, c;
cin >> a >> b;
for (char ca : a) {
for (char cb : b) {
if (ca == cb) {
c.push_back(cb);
break;
}
}
}
char last = 0;
sort(c.begin(), c.end());
for (char cc : c) {
if (last == cc) continue;
last = cc;
cout << last << " ";
}
}