luogu#P8793. [蓝桥杯 2022 国 A] owo
[蓝桥杯 2022 国 A] owo
Background
Unlike the Lanqiao Cup judge testdata, this problem assumes that each character is either o or w, to avoid meaningless and more complicated case discussions (the original problem also did not clearly state the constraints).
Problem Description
Xiao Lan likes owo very much. He now has some strings, and he wants to concatenate these strings so that the final string contains as many owo as possible.
When counting, overlapping is allowed. For example, owowo is counted as , and owowowo is counted as . Please compute how many owo can appear in the final string under the best strategy.
Input Format
The first line contains an integer , which indicates the number of strings Xiao Lan has.
The next lines each contain a string consisting of lowercase English letters.
Output Format
Output lines, each containing an integer, which represents the maximum number of owo that can be obtained by optimally concatenating the first strings.
3
owo
w
ow
1
1
2
Hint
[Test Case Scale and Assumptions]
- For of the test cases, .
- For of the test cases, .
- For of the test cases, .
- For all test cases, , , where denotes the length of string . Each character is either or .
Lanqiao Cup 2022 National Contest, Group A, Problem E.
Translated by ChatGPT 5