Loop to find the pair of strings which are reverse of each other
for i in range ( n ) : NEW_LINE INDENT s = a [ i ] NEW_LINE s = s [ : : - 1 ] NEW_LINE for j in range ( i + 1 , n ) : NEW_LINE INDENT if ( a [ i ] != " " and a [ j ] != " " ) : NEW_LINE INDENT if ( s == a [ j ] ) : NEW_LINE INDENT pair1 [ r ] = a [ i ] NEW_LINE pair2 [ r ] = a [ j ] NEW_LINE r += 1 NEW_LINE a [ i ] = " " NEW_LINE a [ j ] = " " NEW_LINE break NEW_LINE DEDENT DEDENT DEDENT DEDENT s1 = " " NEW_LINE