Find indices of all occurrence of one string in other | Python program to find indices of all occurrences of one String in other . ; Driver code
def printIndex ( str , s ) : NEW_LINE INDENT flag = False ; NEW_LINE for i in range ( len ( str ) ) : NEW_LINE INDENT if ( str [ i : i + len ( s ) ] == s ) : NEW_LINE INDENT print ( i , end = " ▁ " ) ; NEW_LINE flag = True ; NEW_LINE DEDENT DEDENT if ( flag == False ) : NEW_LINE INDENT print ( " NONE " ) ; NEW_LINE DEDENT DEDENT str1 = " GeeksforGeeks " ; NEW_LINE str2 = " Geeks " ; NEW_LINE printIndex ( str1 , str2 ) ; NEW_LINE