Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practicing Statistics Guided Investigations For The Second Course

Authors: Shonda Kuiper, Jeff Sklar

1st Edition

321586018, 978-0321586018

Students also viewed these Computer Network questions

Question

What are the attributes of a technical decision?

Answered: 1 week ago

Question

How do the two components of this theory work together?

Answered: 1 week ago