Submission

Status:
[PPPPPPPP]

Score: 100

User: YoruoniVamp

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

Language: cpp

Time: 0.002 second

Submitted On: 2025-03-12 10:33:59

// YoruoniVamp - VTUBE

#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
#define ld long double
#define ull unsigned ll
#define cint const int
#define cf const float

cint mxA = 1e6+5, MOD = 1e9+7, INF = 0x3f3f3f3f;
cint d4x[4] = {0, 1, 0, -1}, d4y[4] = {1, 0, -1, 0};
cint d8x[8] = {0, 1, 1, 1, 0, -1, -1, -1}, d8y[8] = {1, 1, 0, -1, -1, -1, 0, 1};

void solve(){
    set<char> st;
    string s1, s2; cin >> s1 >> s2;
    int arr1[200], arr2[200];
    memset(arr1,0,sizeof(arr1));
    memset(arr2,0,sizeof(arr2));
    for(char c: s1) arr1[(int)c]++;
    for(char c: s2) arr2[(int)c]++;
    for(int i = 0; i < 200; i++) if(arr1[i]>0&&arr2[i]>0) st.insert(char(i));
    for(auto i: st) cout << i << ' ';
}

int main(){
    cin.tie(nullptr)->sync_with_stdio(0);cout.tie(0);
    // freopen("", "r", stdin);
    // freopen("", "w", stdout);
    int t = 1;
    // cin >> t;
    while(t--) solve();
    return 0;
}