# Help me in solving BLAST3 problem

### My issue

I’m not sure why my code is not able to detect the palindrome in this test case:
1
7
aaaegbb

What is the palindrome in this case? Can anyone tell me? Thank you.

### My code

``````def isPalindrome(string):
if (string == string[::-1]) :
print("The palindrome is: ", string)
return True
else:
return False

t = int(input())

for _ in range(t):
n = int(input())
s = input()

palindrome = False

if n == 1:
palindrome = True
elif n == 2:
if isPalindrome(s):
palindrome = True
else:
palindrome = False
elif n == 3:
if isPalindrome(s):
palindrome = True
else:
palindrome = False
else:
for index in range(1, n - 1):
remove = s[index - 1 : index + 2]
print("string removed is: ", remove)
string = s.replace(remove, '', 1)
print("string is: ", string)
if isPalindrome(string):
palindrome = True
break

if palindrome:
print("YES")
else:
print("NO")
``````

Problem Link: BLAST3 Problem - CodeChef

@mr_try_hard
The palindrome in case where n%3==1 is of size one u can keep first or the last character and remove rest