Submission

Status:

[PPPPPPPP]

Subtask/Task Score:

{100/100}

Score: 100

User: Cmoss9

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

Language: cpp

Time: 0.004 second

Submitted On: 2026-01-04 00:08:00

#include <bits/stdc++.h>
using namespace std;
int main () {
    ios_base::sync_with_stdio(0); cin.tie(0);
    string s1,s2;
    cin >> s1 >> s2;
    vector<bool> lower(26,false), upper(26,false);
    for (auto i : s1) {
        if (i-'A' <= 26 && i-'A' >=0) {
            upper[i-'A'] = true;
        } else if (i-'a' <= 26 && i-'a' >= 0) {
            lower[i-'a'] = true;
        }
    }
    for (auto i : s2) {
        if (i-'A' <= 26 && i-'A' >=0) {
            if (upper[i-'A']) {
                cout << i << ' ';
                upper[i-'A'] = false;
            }
        } else if (i-'a' <= 26 && i-'a' >= 0) {
            if (lower[i-'a']) {
                cout << i << ' ';
                lower[i-'a'] = false;
            }
        }
    }
}