Removing the suffix and prefix subStrings which already forms a palindrome and storing them in separate Strings
prefix = str . substring ( 0 , len ) ; suffix = str . substring ( n - len ) ; str = str . substring ( len , ( n - 2 * len ) + len ) ;