Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: KanemiyaKana

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

Language: cpp

Time: 0.004 second

Submitted On: 2026-09-25 18:03:29

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

string firstdistinct(string word)
{
    sort(word.begin(), word.end());
    string result;

    for (int i = 0; i < word.length(); i++)
    {
        if ((i == 0 || word[i] != word[i - 1]) &&
            (i == word.length() - 1 || word[i] != word[i + 1]))
        {
            result += word[i];
        }
    }

    return result;
}
int main()
{
    string input;
    cin >> input;
    if (input.length() > 20)
    {
        return 0;
    }
    else
    {
        string outputlines = firstdistinct(input);
        cout << outputlines[0];
    }
}