Submission
Status:
[PPPP-SSS]
Subtask/Task Score:
{0/100}
Score: 0
User: Chawin
Problemset: สตริงซ้ำซ้ำ
Language: c
Time: 0.001 second
Submitted On: 2025-10-07 21:32:53
#include <stdio.h>
#include <string.h>
int main(){
char str1[21], str2[21];
scanf("%s %s", &str1, &str2);
int cnt1[123] = {}, cnt2[123] = {};
for(int i = 0; i < strlen(str1); i++){
int ascii = str1[i];
cnt1[ascii]++;
}
for(int i = 0; i < strlen(str2); i++){
int ascii = str2[i];
cnt2[ascii]++;
}
for(int i = 65; i <= 122; i++){
if((cnt1[i] > 0) && (cnt2[i] > 0)){
for(int j = 0; j < cnt1[i]; j++){
printf("%c ", i);
cnt1[i]--;
cnt2[i]--;
}
}
}
return 0;
}