Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Whatthepoop

Problemset: ตัวอักษรตัวแรกในคำ

Language: c

Time: 0.002 second

Submitted On: 2025-10-12 11:31:45

#include <stdio.h>
#include <string.h>

int main(){
    char s[50];
    scanf("%s", s);

    int n = strlen(s);
    char check[50];

    int pos = 0;
    for(int i = 0; i < n; i++){
        int checked = 0;
        for(int k = 0; k < n; k++){
            if(s[k] == s[i]){
                checked++;
            }
        }
        if(checked == 1){
            check[pos++] = s[i];
        }
    }

    for(int i = 0; i < pos-1; i++){
        for(int j = 0; j < pos-i-1; j++){
            if(check[j] > check[j+1]){
                char temp = check[j];
                check[j] = check[j+1];
                check[j+1] = temp;
            }
        }
    }
    
    printf("%c", check[0]);

    return 0;
}