Count Substring Occurrences

PHP Medium 4 views
Back to Questions

Problem Description

Count how many times pattern p occurs in s (overlaps allowed).

Input Format

Two lines: s then p.

Output Format

One integer count.

Sample Test Case

Input:
aaaa aa
Output:
3

Constraints

Total chars

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next