import ru.ifmo.testlib.Checker;
import ru.ifmo.testlib.InStream;
import ru.ifmo.testlib.Outcome;
import static ru.ifmo.testlib.Outcome.Type.*;

public class Check implements Checker {
    public Outcome outcome(Outcome.Type type, final String format, final Object... args) {
        return new Outcome(type, String.format(format, args));
    }

    public Outcome test(InStream inf, InStream ouf, InStream ans) {
        int v = 0;
        while (!ans.seekEoF()) {
            String ja = ans.nextToken().toUpperCase();
            String pa = ouf.nextToken().toUpperCase();
            v++;

            if (!ja.equals(pa)) {
                return outcome(WA, "Expected %s, found %s in position %d", ja, pa, v);
            }
        }
        return outcome(OK, "%d answers", v);
    }
}
