public static void mostLongPalindromeInString(String s) {

		int len = s.length();
		if (len < 2) {
			return;
		}
		int beginPos = 0;
		int endPos = 0;
		int beforePos = 0;
		int afterPos = 1;

		while (afterPos < len && beforePos < afterPos) {

			if (s.charAt(beforePos) == s.charAt(afterPos)
					|| s.charAt(beforePos) == s.charAt(afterPos + 1)) {
				afterPos++;
				while (s.charAt(beforePos) == s.charAt(afterPos)) {
					afterPos++;
				}
				beforePos--;
				while (beforePos >= 0 && afterPos < len) {
					if (s.charAt(beforePos) == s.charAt(afterPos)) {
						beforePos--;
						afterPos++;
					}
				}
				beginPos = beforePos + 1;
				endPos = beforePos = afterPos - 1;
			} else {
				beforePos++;
				endPos++;
			}
		}
		System.out.println("begin=" + beginPos + " end=" + endPos);
	}