Submission

Status:

[PPPPPPPP]

Subtask/Task Score:

{100/100}

Score: 100

User: chs_14

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

Language: cpp

Time: 0.003 second

Submitted On: 2025-12-08 09:58:16

#include <bits/stdc++.h>
using namespace std;

vector<bool> in2(256, false);
vector<bool> printed(256, false);

int main() {
    cin.tie(0)->sync_with_stdio(0);
    string str1, str2;
    cin >> str1 >> str2;

    for (char &c : str2)
    {
        in2[c] = true;
    }

    for (char &c : str1)
    {
        if (in2[c] && !printed[c]) {
            cout << c << ' ';
            printed[c] = true;
        }
    }

    return 0;
}