/******************************************************************/
/* ACM ICPC 2012-2013                                             */
/* Northeastern European Regional Contest                         */
/* St Petersburg - Barnaul - Tashkent - Tbilisi, December 2, 2012 */
/******************************************************************/
/* Problem C. Caravan Robbers                                     */
/*                                                                */
/* Original idea         Egor Kulikov                             */
/* Problem statement     Egor Kulikov                             */
/* Test set              Egor Kulikov                             */
/******************************************************************/
/* Checker                                                        */
/*                                                                */
/* Author                Egor Kulikov                             */
/******************************************************************/

import ru.ifmo.testlib.Checker;
import ru.ifmo.testlib.InStream;
import ru.ifmo.testlib.Outcome;

import static ru.ifmo.testlib.Outcome.Type.OK;
import static ru.ifmo.testlib.Outcome.Type.PE;
import static ru.ifmo.testlib.Outcome.Type.WA;

public class Check implements Checker {

    public Outcome test(InStream inf, InStream ouf, InStream ans) {
        String ja = ans.nextToken();
        String pa = ouf.nextToken();

        if (!pa.matches("\\d+/\\d+"))
            throw new Outcome(PE, String.format("Answer is not a fraction '%s'", pa));
        if (!ouf.seekEoF())
            throw new Outcome(PE, String.format("Extra data in output file"));

        if (!ja.equals(pa)) {
            return new Outcome(WA, String.format("Expected %s, found %s", ja, pa));
        }
        return new Outcome(OK, String.format("%s", ja));
    }
}

