pure-jcore/src/main/java/leetcode/LongestPalindromicSubstring.java
/*
     * Way1 is comparing string with its reversed string and finding the longest common substring,
     * then, it is the longest palindromic substring.
     * e.g. "gabacabah" vs its reversed string "habacabag", the longest common string is "abacaba",
     * which is also the longest palindromic substring.
     * Time Complexity: 
     * 
     */
Way1 is comparing string with its reversed string and finding the longest common substring,
then, it is the longest palindromic substring.
Way1 is comparing string with its reversed string and finding the longest common substring then it is the longest palindromic substring .
private String way1(String s) {
    		String rs = reverseString(s);
    		LongestCommonSubstring lcs = new LongestCommonSubstring();
    		String commonStr = lcs.findCommonSubstring(s, rs, 2);
    		if (!isStringPalindromic(commonStr)) {
    			return commonStr.substring(0, 1); 
    		}
    		return commonStr;
    }
private String way1 ( String s ) { String rs = reverseString ( s ) ; LongestCommonSubstring lcs = new LongestCommonSubstring ( ) ; String commonStr = lcs . findCommonSubstring ( s , rs , 2 ) ; if ( ! isStringPalindromic ( commonStr ) ) { return commonStr . substring ( 0 , 1 ) ; } return commonStr ; }
Way1 is comparing string with its reversed string and finding the longest common substring,
 then, it is the longest palindromic substring.
Way1 is comparing string with its reversed string and finding the longest common substring then it is the longest palindromic substring .
// for some coner case, the common substring is not palindromic string, // e.g. abcdfgdcba vs abcdgfdcba -> LCS: abcd. // return the first letter