#K62832. Count Phrase Occurrences

    ID: 31619 Type: Default 1000ms 256MiB

Count Phrase Occurrences

Count Phrase Occurrences

You are given a note and a query phrase. Your task is to determine the number of times the query appears inside the note in a case-insensitive manner. Note that occurrences of the query may overlap.

For example, in the note "banana", the query "ana" appears 2 times, and in the note "aaaa", the query "aa" appears 3 times.

This problem requires handling multiple test cases.

inputFormat

Input is read from standard input (stdin). The first line contains an integer n indicating the number of test cases. Each test case consists of two lines:

  • The first line is a note (a string).
  • The second line is the query phrase (a string).

outputFormat

For each test case, print a single line to standard output (stdout) that contains the number of occurrences of the query in the note.

## sample
3
banana
ana
Hello World
world
aaaa
aa
2

1 3

</p>