Check if character in arr [ i ] [ j ] is present in the S or not
if ( list [ i ] [ j ] in valid ) : NEW_LINE INDENT j += 1 NEW_LINE continue NEW_LINE DEDENT else : NEW_LINE INDENT break NEW_LINE DEDENT j += 1 NEW_LINE