Contiguous unique substrings with the given length L | Function to print the unique sub - string of length n ; set to store the strings ; if the size of the string is equal to 1 then insert ; inserting unique sub - string of length L ; Printing the set of strings ; Driver Code ; Function calling
def result ( s , n ) : NEW_LINE INDENT st = set ( ) ; NEW_LINE for i in range ( len ( s ) ) : NEW_LINE INDENT ans = " " ; NEW_LINE for j in range ( i , len ( s ) ) : NEW_LINE INDENT ans += s [ j ] ; NEW_LINE if ( len ( ans ) == n ) : NEW_LINE INDENT st . add ( ans ) ; NEW_LINE break ; NEW_LINE DEDENT DEDENT DEDENT for it in st : NEW_LINE INDENT print ( it , end = " ▁ " ) ; NEW_LINE DEDENT DEDENT if __name__ == " _ _ main _ _ " : NEW_LINE INDENT s = " abca " ; NEW_LINE n = 3 ; NEW_LINE result ( s , n ) ; NEW_LINE DEDENT