Mid2 9th_Count_Substring_Occurrences

 str1="'azcmamamegghakl"

str2="mam"
count1=0
for i in range (len(str1)):
    if str1[i:i+len(str2)]==str2:
        count1+=1
print(count1)
#output:2

Comments

Popular posts from this blog

JAVA Lab Programs

HANGMAN GAME

WD 22. StylingLinks&Buttons