Wow and Queries
InterviewTime limit1sMemory limit1024 MB
Given Q strings made of W and O, count how many times the substring WOW appears in each one.
- Level
Easy1 of 10
- Topics
- String, Implementation
- Solved
- No attempts yet
Problem

Hongik University has a mascot named Wow. People who see Wow cannot help but shout because it is so cute. While studying sounds, you learned how to measure how cute Wow is.
Let the sound people make be a string . You found that the number of occurrences of the substring WOW in is exactly how cute Wow is at that moment. Given sounds, find the cuteness of each one.
Input
The first line contains the number of sounds . ()
From the second line on, each of the next lines gives one sound to analyze. (The length of is at least and at most , and contains only W and O.)
Output
For each sound, print the cuteness of Wow analyzed from that sound, one per line, in input order.