Submission

Status:

[PPPPPPPP]

Subtask/Task Score:

{100/100}

Score: 100

User: sakuragichan

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

Language: cpp

Time: 0.002 second

Submitted On: 2026-09-08 10:07:47

#include <bits/stdc++.h>
using namespace std;

int main() {
	string x,y;
	cin >> x >> y;
    if (x < y) {
        for (int i = 0; i<= x.length() ;++i) {
            if (count(y.begin(), y.end(), x[i]) > 0) {
                cout << x[i] << " ";
                y.erase(remove(y.begin(), y.end(), x[i]), y.end());
            }
        }
    }
    else {
        for (int i = 0; i<= y.length() ;++i) {
            if (count(x.begin(), x.end(), y[i]) > 0) {
                cout << y[i] << " ";
                x.erase(remove(x.begin(), x.end(), y[i]), x.end());
            }
        }
    }
}