Check if a string contains two non overlapping sub | Function that returns true if s contains two non overlapping sub strings " geek " and " keeg " ; If " geek " and " keeg " are both present in s without over - lapping and " keeg " starts after " geek " ends ; Driver code
def isValid ( s ) : NEW_LINE INDENT p = " " NEW_LINE p = s . find ( " geek " ) NEW_LINE if ( s . find ( " keeg " , p + 4 ) ) : NEW_LINE INDENT return True NEW_LINE DEDENT return False NEW_LINE DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT s = " geekeekeeg " NEW_LINE if ( isValid ( s ) ) : NEW_LINE INDENT print ( " Yes " ) NEW_LINE DEDENT else : NEW_LINE INDENT print ( " No " ) NEW_LINE DEDENT DEDENT