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.*; class main { static class Fragment { String text; // should not be null like ever transient int hashCode; Fragment() {} Fragment(String text) { this.text = trim(text); } public String toString() { return text == null ? "null fragment you bunny" : text; } public int hashCode() { if (hashCode == 0) hashCode = main.hashCode(upper(text)); return hashCode; } // Note: we have the "turkish" problem (upper <-> eqic) public boolean equals(Object o) { // we could allow string here too but that's nasty if (!(o instanceof Fragment)) return false; return eqic(text, ((Fragment) o).text); } } static String trim(String s) { return s == null ? null : s.trim(); } static String trim(StringBuilder buf) { return buf.toString().trim(); } static String trim(StringBuffer buf) { return buf.toString().trim(); } static int hashCode(Object a) { return a == null ? 0 : a.hashCode(); } static String upper(String s) { return s == null ? null : s.toUpperCase(); } static char upper(char c) { return Character.toUpperCase(c); } static boolean eqic(String a, String b) { if ((a == null) != (b == null)) return false; if (a == null) return true; return a.equalsIgnoreCase(b); } static boolean eqic(char a, char b) { if (a == b) return true; char u1 = Character.toUpperCase(a); char u2 = Character.toUpperCase(b); if (u1 == u2) return true; return Character.toLowerCase(u1) == Character.toLowerCase(u2); } static boolean eq(Object a, Object b) { return a == b || a != null && b != null && a.equals(b); } static String asString(Object o) { return o == null ? null : o.toString(); } static String str(Object o) { return o == null ? "null" : o.toString(); } static String str(char[] c) { return new String(c); } }