#include "validator.h"

void run() {
    int maxn = toml<int>("MAXN");
    string mode = toml<string>("MODE");
    if(!set<string>{"","alternating","one"}.count(mode))
        die_line("unknown mode: " + mode);

    int n = Int(3, maxn);
    Endl();
    int cnt = 0;
    char frst;
    for(int i=0; i<n; i++){
        char c = _peek1();
        Char(c);
        if(c != '+' && c != '-'){
            die_line("not valid query");
        }
        if(i == 0){
            frst = c;
        }
        if(c == '+') cnt++;
        if(mode == "alternating" && ((i%2 == 0 && c != frst) || (i%2 == 1 && c == frst))) die_line("in alt mode, + and - must alternate");
    }
    Endl();
    if(mode == "one" && cnt != 1) die_line("in one mode, there must be exactly one +");
    Eof();
    return;
}
