Submission

Status:

PPPPPPPP-P

Subtask/Task Score:

90/100

Score: 90

User: kinzap

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

Language: cpp

Time: 0.002 second

Submitted On: 2025-10-12 15:22:20

#include <iostream>
#include <stack>

using namespace std;

stack<char> s;
string n;

int amount,day,date;

int main(){
    cin >> n;
    for(int i = 0;i<n.length();i++){
        if(s.size()==0) s.push(n[i]);
        else{
            if(s.top()>n[i]){
                s.push(n[i]);
            }
            else if(s.top() == n[i]){
                s.pop();
            }
        }
    }
    cout << s.top();
}