Submission

Status:

[PPPP-SSS]

Subtask/Task Score:

{0/100}

Score: 0

User: Catpao

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

Language: cpp

Time: 0.002 second

Submitted On: 2025-09-26 23:19:30

#include<bits/stdc++.h>
using namespace std;
int count1[1000],count2[1000];
int main()
{
	int max,sum = 0;
	string a,b;
	cin>>a;
	cin>>b;
	if(a.size() >= b.size()){
		max = a.size();
	}
	else if(b.size() > a.size()){
		max = b.size();
	}
	for(int i=0;i<max;i++){
		for(int j=0;j<max;j++){
			if(max = a.size()){
				if(a[i] == b[j]){
					count1[i]++;
				}
			}
			else if(max = b.size()){
				if(b[i] == a[j]){
					count2[i]++;
				}
			}
		}
	}
	for(int i=0;i<max;i++){
		if(max = a.size()){
			if(count1[i] >=1){
				cout<<a[i]<<' ';
			}
		}
		else if(max = b.size()){
			if(count2[i] >=1){
				cout<<b[i]<<' ';
			}
		}
	}
}