Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: Patn01Z
Problemset: ตัวอักษรตัวแรกในคำ
Language: cpp
Time: 0.002 second
Submitted On: 2026-09-28 16:33:25
#include <iostream>
#include <cmath>
using namespace std;
int main(){
string word;
cin >> word;
int wl = word.length();
for(int i=0;i<wl;i++){
for(int j=0;j<wl-1-i;j++){
if(word[j]>word[j+1]){
swap(word[j],word[j+1]);
}
}
}
for(int i=0;i<wl;i++){
if(i==0){
if(word[i]!=word[i+1]){
cout << word[i];
break;
}
}
else if((i>0)&&(i<(wl-1))){
if((word[i]!=word[i+1])&&(word[i]!=word[i-1])){
cout << word[i];
break;
}
}
else{
if(word[i]!=word[i-1]){
cout << word[i];
break;
}
}
}
}