Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Max

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

Language: cpp

Time: 0.003 second

Submitted On: 2025-10-13 17:28:04

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main(){
    string word;
    cin >> word;
    char alpa;
    int i, j, len, count;
    len = word.length();
    string toRemove = "";
    for (i=0; i<len; i++)
    {
        count = 0;
        alpa = word[i];
        for (j=0; j<len; j++)
        {
            if (alpa == word[j])
                count++;
        }
        if (count > 1)
        {
            toRemove += alpa;
        }
    }
    for (char c : toRemove)
        word.erase(remove(word.begin(), word.end(), c), word.end());
    char min;
    min = word[0];
    len = word.length();
    for (i=0; i<len; i++)
    {
        if (word[i] < min)
            min = word[i];
    }
    cout << min << endl;
}