Submission

Status:

[PPPPPPPP]

Subtask/Task Score:

{100/100}

Score: 100

User: pond4545

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

Language: cpp

Time: 0.002 second

Submitted On: 2025-10-08 20:04:02

#include<iostream>
#include<string>
using namespace std;

int main()
{
    string p1,p2,c;
    cin >> p1 >> p2;
    for(int i=0;i<p1.length();i++)
    {
        for (int j=0;j<p2.length();j++)
        {
            if(p1[i]==p2[j])
            {
                bool a=false;
                for(int k=0;k<c.length();k++)
                {
                    if(c[k]==p2[j])
                    {
                        a=true;
                    }
                }
                if(!a)
                {
                    c+=p2[j];
                }
            }
        }
    }
    for(int i=0;i<c.length();i++)
    {
        cout << c[i] << " ";
    }
    return 0;
}