Submission
Status:
[PPPPPPPP]
Subtask/Task Score:
{100/100}
Score: 100
User: Nitro_Legacy
Problemset: สตริงซ้ำซ้ำ
Language: cpp
Time: 0.002 second
Submitted On: 2026-09-24 20:16:47
#include <bits/stdc++.h>
using namespace std;
int main(){
string s1, s2;
cin >> s1 >> s2;
int a1[52] = {};
int a2[52] = {};
for (int i = 0; i < s1.size(); i++){
if (s1[i] < 97){
a1[s1[i] - 'A']++;
} else {
a1[s1[i] - 'a' + 26]++;
}
}
for (int i = 0; i < s2.size(); i++){
if (s2[i] < 97){
a2[s2[i] - 'A']++;
} else {
a2[s2[i] - 'a' + 26]++;
}
}
for (int i = 0; i < 52; i++){
if (a1[i] > 0 && a2[i] > 0){
if (i < 26){
cout << char('A' + i) << " ";
} else {
cout << char('a' + i - 26) << " ";
}
}
}
return 0;
}