Untitled

 avatar
unknown
c_cpp
a year ago
506 B
0
Indexable
#include <iostream>
using namespace std;
int main()
{
    bool secondZero = false; // 0

    int max = -1;
    int tmp;
    bool konec = false;
    while (!konec) {
        cin >> tmp;

        if (tmp == 0) {
            if (secondZero == true) {
                konec = true;
            }
            else if (secondZero == false) secondZero = true;
        }
        else {
            secondZero = false;
            if (tmp > max) max = tmp;
        }
    }
    cout << max;
}