import java.util.*;
import java.util.zip.*;
import java.util.List;
import java.util.regex.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.*;
import java.util.concurrent.locks.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.*;
import javax.swing.table.*;
import java.io.*;
import java.net.*;
import java.lang.reflect.*;
import java.lang.ref.*;
import java.lang.management.*;
import java.security.*;
import java.security.spec.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import javax.imageio.*;
import java.math.*;
// returns pair(var, function name)
// e.g. for ForWhere(formatFrag("$x"), formatFrag("hasWord($x)"), ...)
class main {
static Pair forWhereParseSimpleFunctionCall(ForWhere fw, DeepZipTools tools) {
if (fw != null && tools.isVar(fw.var) && fw.condition instanceof FunctionCall) {
FunctionCall fc = (FunctionCall) (fw.condition);
if (eq(fc.args(), ll(fw.var)))
return pair(fw.var, fc.function);
}
return null;
}
static boolean eq(Object a, Object b) {
return a == b || (a == null ? b == null : b != null && a.equals(b));
}
static List ll(A... a) {
ArrayList l = new ArrayList(a.length);
if (a != null) for (A x : a) l.add(x);
return l;
}
static Pair pair(A a, B b) {
return new Pair(a, b);
}
static Pair pair(A a) {
return new Pair(a, a);
}
static String str(Object o) {
return o == null ? "null" : o.toString();
}
static String str(char[] c) {
return new String(c);
}
static class ForWhere implements IFieldsToList, Transformable{
Object var;
Object condition;
Object body;
ForWhere() {}
ForWhere(Object var, Object condition, Object body) {
this.body = body;
this.condition = condition;
this.var = var;}
public String toString() { return shortClassName(this) + "(" + var + ", " + condition + ", " + body + ")"; }
public boolean equals(Object o) {
if (!(o instanceof ForWhere)) return false;
ForWhere x = (ForWhere) o;
return eq(var, x.var) && eq(condition, x.condition) && eq(body, x.body);
}
public int hashCode() {
int h = 518601150;
h = boostHashCombine(h, _hashCode(var));
h = boostHashCombine(h, _hashCode(condition));
h = boostHashCombine(h, _hashCode(body));
return h;
}
public Object[] _fieldsToList() { return new Object[] {var, condition, body}; }
public Object transformUsing(IF1 f) { return new ForWhere(f.get(var), f.get(condition), f.get(body)); }
}static class DeepZipTools {
// define what a variable is
transient IF1