Submission

Status:

[PPPPPPPP]

Subtask/Task Score:

{100/100}

Score: 100

User: ZanTy

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

Language: cpp

Time: 0.003 second

Submitted On: 2026-10-04 10:17:16

#include<bits/stdc++.h>

char a[25];
char b[25];
char check[25];
int cnt;

int main(){
    scanf("%s",a);
    scanf("%s",b);
    for (int i = 0;a[i] != '\0';i++){
        char need = '\0';
        int state = 1;
        for (int j = 0;b[j] != '\0';j++){
            if (a[i] == b[j]){
                need = a[i];
                break;
            }
        }
        for (int j = 0;j < cnt;j++){
            if (need == check[j]){
                state = 0;
                break;
            }
        }
        if (state && need != '\0'){
            printf("%c ",need);
            check[cnt] = need;
            cnt++;
        }
    }
}