Submission

Status:

[PPPPPPPP]

Subtask/Task Score:

{100/100}

Score: 100

User: Phupa

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

Language: cpp

Time: 0.002 second

Submitted On: 2025-10-08 08:06:37

#include <iostream>//bkk ข้อ2ครับ
#include <string>
using namespace std;
int main()
{
    string str1,str2;
    int lon1,lon2,ascii1[256]={0},ascii2[256]={0},i,j;
    cin>>str1>>str2;
    lon1 = str1.length();
    lon2 = str2.length();
    for (i=0;i<lon1;i++)
    {
        for (j=0;j<256;j++)
        {
            if (str1[i]==j)
                ascii1[j] += 1;
        }
    }
    for (i=0;i<lon2;i++)
    {
        for (j=0;j<256;j++)
        {
            if (str2[i]==j)
                ascii2[j] += 1;
        }
    }
    for (i=0;i<256;i++)
        if (ascii1[i]>0&&ascii2[i]>0)
            cout<<(char)(i)<<" ";
}