Submission
Status:
[PPPPPPPP]
Subtask/Task Score:
{100/100}
Score: 100
User: cyblox_boi
Problemset: สตริงซ้ำซ้ำ
Language: cpp
Time: 0.002 second
Submitted On: 2025-10-16 08:48:23
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
vector<string> texts(2);
for (int i = 0; i < 2; i++)
{
cin >> texts[i];
}
if (texts[1].length() > texts[0].length())
{
swap(texts[0], texts[1]);
}
set<char> duplicate;
for (int i = 0; i < texts[0].length(); i++)
{
if (find(texts[1].begin(), texts[1].end(), texts[0][i]) != texts[1].end())
{
duplicate.emplace(texts[0][i]);
}
}
for (const char &i : duplicate)
{
cout << i << ' ';
}
cout << '\n';
return 0;
}