409350: GYM103488 D Diseased String

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

D. Diseased Stringtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

You are given a string $$$s$$$ of length $$$n$$$ consisting of lowercase English letters. A $$$ybb$$$ substring $$$t$$$ is defined as a substring of $$$s$$$ which meets the following conditions:

  • The length of $$$t$$$ is not less than $$$3$$$. Formally, $$$|t|\ge 3$$$.
  • The first character of $$$t$$$ is $$$y$$$, and the other characters are $$$b$$$.
You should count the number of $$$ybb$$$ substrings.

A substring of a string $$$s$$$ is a sequence $$$s_l, s_{l+1}, \dots, s_r$$$ for some integers $$$(l, r)$$$ such that $$$(1\le l\le r\le n),$$$ in which $$$n$$$ is the length of the string $$$s$$$.

Input

The first line contains an integer $$$T(1\le T\le 100)$$$ — the number of test cases.

The first line of each test case contains an integer $$$n(1\le n\le 100)$$$ — the length of string $$$s$$$.

The second line contains a string $$$s$$$. It's guaranteed that $$$s$$$ consists only of lowercase English letters.

Output

For each test case, output an integer in one line. — The number of $$$ybb$$$ substrings.

ExampleInput
2
10
yybybbybbb
4
yabb
Output
3
0
Note

In the test case $$$1$$$, there are $$$3$$$ $$$ybb$$$ substrings: $$$[s_4,s_5,s_6]$$$, $$$[s_7,s_8,s_9]$$$ and $$$[s_7,s_8,s_9,s_{10}]$$$, which are $$$ybb$$$, $$$ybb$$$ and $$$ybbb$$$ respectively.

加入题单

算法标签: