Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: chypnx
Problemset: ตัวอักษรตัวแรกในคำ
Language: cpp
Time: 0.002 second
Submitted On: 2025-10-03 16:58:40
#include <bits/stdc++.h>
using namespace std;
int main(){
string txt;
cin >> txt;
sort(txt.begin(), txt.end());
if (txt.length() == 1){
cout << txt[0];
} else {
int i = 1;
while (i < txt.length()) {
if (txt[i] == txt[i-1]) {
txt.erase(i-1, 2); // ź 2 ??ǫ??
if (i > 1) i--; // ?????礵?ǡ?˹??????
} else {
i++;
}
}
if (!txt.empty())
cout << txt[0];
else
cout << "EMPTY"; // ?ѹ???ó?ź?????
}
return 0;
}