In Strangeland, people name their child in a cute way. I’m sure you already know the way by the prob…
Click here to read the complete problem statement.
If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.
T = int(input())
l = []
l_list = []
for x in range(T):
S= str(input())
l.append(S)
r = 0
No_r = False
for j in reversed(range(0,len(S))):
if S[j]==S[-1] and not No_r:
r += 1
else:
No_r = True
if len(S)-r == 0:
l_name = S[0]
else:
l_name= S[0:len(S)-r]
l_name=l_name[::-1]
l_list.append(l_name)
for i in range(T):
print(l[i],l_list[i])
Currently stuck at test case 3 does anyone has a solution for me?