Submission
Status:
[PPPPPPPP]
Subtask/Task Score:
{100/100}
Score: 100
User: winniecoder1029
Problemset: สตริงซ้ำซ้ำ
Language: cpp
Time: 0.002 second
Submitted On: 2025-10-13 20:03:39
#include <iostream>
#include <cstring>
#include <map>
using namespace std;
int main() {
char s1[21], s2[21], c;
cin >> s1;
cin >> s2;
map<char, int> count1, count2;
for (int i = 0; i<strlen(s1); i++) {
c = s1[i];
count1[c] = 1;
}
for (int j = 0; j<strlen(s2); j++) {
c = s2[j];
count2[c] = 1;
}
for (auto &m : count2) {
if (count1.find(m.first) != count1.end()){
count1[m.first]++;
}
}
for (auto &k : count1) {
if (k.second > 1) {
cout << k.first << " ";
}
}
}