Submission

Status:

---PP---PP

Subtask/Task Score:

40/100

Score: 40

User: havename

Problemset: Maximum Adjacent

Language: cpp

Time: 0.002 second

Submitted On: 2026-03-04 09:36:32

#include<bits/stdc++.h>
using namespace std;

int main(){
    int a, b;
    cin >> a >> b;

    string s;

    while(cin >> s){

        if(!isdigit(s[0])){   // เจอตัวอักษร
            if(b > a){       // เช็คตัวสุดท้าย
                cout << b << " ";
            }
            break;
        }

        int e = stoi(s);

        if(b > a && b > e){  // local maximum
            cout << b << " ";
        }

        a = b;
        b = e;
    }
}