static boolean check(int a, int b, int l) {
		if ((b - a + 1) % l != 0)
			return false;
		int pos = 0;
		for (int i = a + l; i <= b; i++) {
			if (w[a + pos] != w[i])
				return false;
			pos = (pos + 1) % l;
		}
		return true;
	}