Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/string-qism-satr-necha-marta

Count substring occurrences

Medium 1000 ms 128 MB 53%
Share

Strings $s$ and $t$ of lowercase Latin letters are given. Find how many times $t$ occurs inside $s$. Occurrences may overlap (aba occurs $3$ times in abababa).

All the positions where the substring occurs in the main string

Input

The first line contains $s$, the second line $t$.

Output

One integer.

Note

$1 \le |s| \le 10^{5}$
$1 \le |t| \le 10$
$s$ and $t$ consist of lowercase Latin letters only

Examples

Input #1
abababa
aba
Output #1
3
Input #2
algor
z
Output #2
0

Sign in to submit a solution

Signing up is free and takes a minute.