|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|2 초||512 MB||0||0||0||0.000%|
The problem statement is almost identical to the previous problem with a few modified sentences in bold.
As a sculptor from his youth, da Vinci had designed many sculptures, however few of them had been brought to completion and only one of them, The Virgin with the Laughing Child, survived. It took da Vinci a long time and lots of materials to complete this sculpture.
Specifically, da Vinci planned to spend n days on the first phase of this project. Initially, da Vinci did not have any materials to sculpt. On each day, he would either take a day off (marked as ‘o’) and go to the market to buy 1 unit of materials, or work (marked as ‘w’) on the sculpture and consume 1 unit of materials. However, after creating the schedule, da Vinci noticed that it was not realistic – on some workdays, he might not have any material to work on at all, and finally he might end up with unused materials. To ensure smooth progress on this sculptural project, da Vinci decided to cancel some of his activities on certain days so that:
Da Vinci would like to know the number of ways to cancel the minimum number of activities to satisfy these conditions. Two schedules are considered different if there exists at least one activity canceled in one schedule but preserved in the other.
The first line contains a number 1 ≤ K ≤ 10, which is the number of input data sets in the file. This is followed by K data sets of the following form:
Each data set is described by a single line containing a non-empty string S, describing da Vinci’s original schedule. The length of S is at most 1000 and it consists of ‘w’ and ‘o’ only. You can compute n by reading the length of S.
For each data set, first output “Data Set x:” on a line by itself, where x is its number.
Then output the number of ways to cancel the minimum activities to make the schedule feasible. Since the answer might be very large, you should output the answer modulo 109 + 7.
Each data set should be followed by a blank line.
4 oowowwowowwoow www owowowowwo oooooooooowwwww
Data Set 1: 12 Data Set 2: 1 Data Set 3: 5 Data Set 4: 252