Submission

Status:

[-SSSSSSSSS]

Subtask/Task Score:

{0/100}

Score: 0

User: asdasd

Problemset: เรียงสตริง

Language: cpp

Time: 0.002 second

Submitted On: 2025-10-10 22:36:34

#include <stdio.h>
#include <string.h>
int main(){
    char word1[30];
    char word2[30];
    scanf("%s" ,word1);
    scanf("%s" ,word2);
    int count_1 = strlen(word1);
    int count_2 = strlen(word2);
    int max = count_1;
    int min = count_2;
    if(count_2>count_1){
        max = count_2;
        min = count_1;
    }
    for(int i = 0 ; i<min ; i++){
        for(int j = 0 ; j<max ; j++)
        if(count_1>=count_2){
            if(word1[j]==word2[i]){
                printf("%c ",word1[j]);
            }
        }
        else if(count_1<count_2){
            if(word2[j]==word1[i]){
                printf("%c ",word2[j]);
            }
        }
    }
}