Skip to content

Latest commit

 

History

History

find-a-string

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Find a string

https://www.hackerrank.com/challenges/find-a-string

Problem

In this challenge, the user enters a string and a substring. You have to print the number of times that the substring occurs in the given string. String traversal will take place from left to right, not from right to left.

Input Format

The first line of input contains the original string. The next line contains the substring.

Output Format

Output the integer number indicating the total number of occurrences of the substring in the original string.

Sample Input 0

ABCDCDC
CDC

Sample Input 0

2

My Solution