Submission

Status:
[PPPPPPPP]

Score: 100

User: Winzzwz

Problemset: สตริงซ้ำซ้ำ

Language: cpp

Time: 0.002 second

Submitted On: 2024-11-10 23:03:56

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
string s1,s2;
unordered_map <char,bool> mark;
unordered_map <char,bool> mark2;
int main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    cin >> s1 >> s2;
    int sz1 = s1.size(), sz2 = s2.size();
    for (int i = 0; i < sz1; i++) {
        mark[s1[i]] = true;
    }
    for (int i = 0; i < sz2; i++) {
        if (mark2[s2[i]]) continue;
        mark2[s2[i]] = true;
        if (mark[s2[i]]) cout << s2[i] << " ";
    }
    return 0;
}