python
Dashboard
My Repos
Compilers
Python Online
Node JS Online
Golang Online
codepy
Login
My Repos
Sign Out
Online Python Interpreter
Stop
Run
line=input("input line: ") sub=input("enter substring: ") length=len(line) lensub=len(sub) start=count=0 end=length while True: pos=line.find(sub,start) if pos!=-1: count+=1 start=pos+lensub else: break if start>=length: break print("no. of occurence of",sub,':',count)
Share this code with others
Public
Clear
My Repos
Repo
Lang
Login
Register
Login
Create a free account. No Credit card info required.
I agree with the Codepy
Term of Service
Sign Up