O Level Exam : Practical Question
📝 HTML
🎨 CSS
⚡ Java Script
#WAP to print the number of occurrences of a substring into a line. s=input("Enter a String : ") substr=input("Enter a sub String : ") l=len(s) lsub=len(substr) start=count=0 end=l while True: position=s.find(substr,start,end) if position!=-1: count+=1 start=position+lsub else: break if start>=l: break; print("No. of Occurrence of : ",substr," : ",count)
▶ Run Code
🖥 Output: