import ru.ifmo.testlib.*;
import ru.ifmo.testlib.Outcome.Type;
import java.util.*;

public class Check implements Checker {
    @Override
    public Outcome test(InStream inf, InStream ouf, InStream ans) {               
	String s = inf.nextLine();
	String sa = ans.nextLine();
	String so = ouf.nextLine();	
	for (int i = 0; i < so.length(); i++) {
		if (so.charAt(i) != so.charAt(so.length() - 1 - i)) return new Outcome(Type.WA, "Not a polindrom");
	}
	if (kmpMatcher(so, s) == -1) return new Outcome(Type.WA, "No name of god in this word");
	if (so.length() < sa.length()) return new Outcome(Type.FAIL, "He can better");
	if (so.length() > sa.length()) return new Outcome(Type.WA, "We can better");
	return new Outcome(Type.OK, "Length = " + sa.length());
    }

  private static int[] prefixFunction(String s) {
    int[] p = new int[s.length()];
    p[0] = 0;
    int k = 0;
    for (int i = 1; i < s.length(); i++) {
      while (k > 0 && s.charAt(k) != s.charAt(i))
        k = p[k - 1];
      if (s.charAt(k) == s.charAt(i))
        ++k;
      p[i] = k;
    }
    return p;
  }

  private static int kmpMatcher(String s, String pattern) {
    int m = pattern.length();
    if (m == 0)
      return 0;
    int[] p = prefixFunction(pattern);
    for (int i = 0, k = 0; i < s.length(); i++)
      for (;; k = p[k - 1]) {
        if (pattern.charAt(k) == s.charAt(i)) {
          if (++k == m)
            return i + 1 - m;
          break;
        }
        if (k == 0)
          break;
      }
    return -1;
  }


}
