@@ -0,0 +1,1160 @@
+public class LongestPalindromicSubstring %7B%0A    // using manacher's algorithm%0A    public static String longestPalindrome(String s) %7B%0A        if (s == null %7C%7C s.length() == 0) %7B%0A            return %22%22;%0A        %7D%0A        %0A        int length = s.length();    %0A        int max = 0;%0A        String result = %22%22;%0A        for(int i = 1; i %3C= 2 * length - 1; i++)%7B%0A            int count = 1;%0A            while(i - count %3E= 0 && i + count %3C= 2 * length  && get(s, i - count) == get(s, i + count))%7B%0A                count++;%0A            %7D%0A            count--; // there will be one extra count for the outbound #%0A            if(count %3E max) %7B%0A                result = s.substring((i - count) / 2, (i + count) / 2);%0A                max = count;%0A            %7D%0A        %7D%0A        %0A        return result;%0A    %7D%0A    %0A    private static char get(String s, int i) %7B%0A        if(i %25 2 == 0)%0A            return '#';%0A        else %0A            return s.charAt(i / 2);%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        System.out.println(longestPalindrome(%22a%22));%0A        System.out.println(longestPalindrome(%22abba%22));%0A        System.out.println(longestPalindrome(%22aba%22));%0A    %7D%0A%7D

Complete Longest Palindromic Substring