Submission

Status:

[PPPPPPPP]

Subtask/Task Score:

{100/100}

Score: 100

User: kkxkkx001

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

Language: cpp

Time: 0.002 second

Submitted On: 2026-10-08 15:19:33

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

int main (){
	string one , two,result;
	result = "";
	cin >> one;
	cin >> two;
	int sizeone = one.size();
	int sizetwo = two.size();
	
	
	for(int i=0;i<sizeone;i++){
		for (int j=0;j<sizetwo;j++){
			if (one[i]==two[j]){
				bool n=true;
				for (int k=0;k<result.size();k++){
					if (one[i]==result[k]){
						n=false;
					}
				}
				if (n==true){
					result += one[i];
				}
			}
		}
	}
	
	for (int i=0;i<result.size()-1;i++){
		cout << result[i] << " ";
	}
	cout << result[result.size()-1];
}