Question: Version of Python being used is 2.7. You be given two strings containing only English letters. Write an algorithm to count the number of occurrences
- Version of Python being used is 2.7. You be given two strings containing only English letters. Write an algorithm to count the number of occurrences of the second string in the first string. (You may disregard the case of the letters.) Input The first line of the input consists of a string parent, representing the first string. The second line consists of a string sub, representing the second string. Output Print an integer representing the number of occurrences of Sub in Parent. If no occurrence of Sub is found in Parent then print 0. Example Input: TimisplayinginthehouseofTimwiththel Tim Output: 3 Explanation: Tim occurs 3 times in the first string. So, the output is 3. 21°C Mostly cloudy
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
