public String longestPalindrome(String s) {
        // Start typing your Java solution below
        // DO NOT write main() function
    	if (s == null || "".equals(s.trim())) return s;
    	for (int i = s.length() ; i >= 1 ; i-- )
    	{
    		for (int j = 0; j < s.length() - i + 1 ; j ++ )
    		{
    			if (checkPalindromic(s.substring(j,j+i)))
    			{
    				return s.substring(j, j+i);
    			}
    		}
    		
    	}
        return null;
    }