public static boolean isOneEditDistance(String s, String t) {
		int m = s.length(), n = t.length();
		if (m > n)
			return isOneEditDistance(t, s);
		if (n - m > 1)
			return false;
		boolean firsttime = true;
		int i = 0, j = 0;
		while (i < m) {
			if (s.charAt(i) != t.charAt(j)) {
				if (!firsttime)
					return false;
				firsttime = false;
				if (m == n) {
					i++;
					j++;
				} else
					j++;
			} else {
				i++;
				j++;
			}
		}
		return !firsttime || (firsttime && n - m == 1); // notice short circuit
	}