HALINDROME Given string S. Let us divide S to two equal parts S1 and S2. S is called halindrome if atleast any one of the following condition satisfy. a) String S is palindrom and length of S >=2 b) String S1 is halindrom. c) String s2 is halindrom. In case of odd length string, the middle element is not present in both S1 and S2. If index of middle element is M, then S1 is equal to S[0,m-1] and S2 = S[m+1, |S|- 1].
Input Specification
Input1: No. of strings. 1<= Input1 <=100
Output Specification find whether string is halindrome.
A string is Halindrom if any one of the criteria is correct .
a) String S is palindrom and its length is >=2
b) String S1 is halindrom.
c) String s2 is halindrom. if string length of S is odd then center letter is ignored and S1 is [0, len/2 -1] and S2 is [len/2+1, len-1]
Comments
Leave a comment