Submission

Status:

[PPPPPPPP]

Subtask/Task Score:

{100/100}

Score: 100

User: ssens3

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

Language: cpp

Time: 0.002 second

Submitted On: 2026-09-30 13:47:14

#include <iostream>
#include <string>
using namespace std;
int main(){
    string s1, s2; cin >> s1 >> s2; int u[26] = {0}, l[26] = {0};
    for (char c : s1){
        if (c >= 'A' && c <= 'Z') u[c - 'A']++;
        else if (c >= 'a' && c <= 'z') l[c - 'a']++;
    }
    for (char c : s2){
        if (u[c - 'A'] > 0 && c >= 'A' && c <= 'Z'){
            cout << c << " "; u[c - 'A'] = 0;
        }
        else if (l[c - 'a'] > 0 && c >= 'a' && c <= 'z'){
            cout << c << " "; l[c - 'a'] = 0;
        }
    }
}