Old Gold
메모리 제한1024 MB
각 '.' 위치에 금을 놓거나 놓지 않는 2^k가지 배치 중에서 <, =, >, o 표시를 모두 만족하고 금이 최소 하나 있는 경우의 수를 10^9+7로 나눈 나머지를 구한다.
문제
A long, long time ago ( years) you were in a West-East road in southeast Asia known to contain at least one gold nugget, with a limited but reliable gold detector. After getting immensely rich with that gold, you have tried and got bored of every conceivable activity. While wandering around your huge mansion you found some notes from that gold hunt.
The notes are in the form of a diagram of the road. For each kilometer of road, you have one of markings:
<, indicating that the closest gold nugget is to the West,=, indicating that the closest gold nuggets to the East and to the West are at the same distance, and no gold nugget is at that position,>, indicating that the closest gold nugget is to the East,o, indicating that there is a gold nugget at that position, or., indicating that nothing is known about that location.
Since each of the unknown (.) positions could contain or not contain a gold nugget independently, you want to find out how many of the placements of gold are compatible with all your notes and result in the road overall containing at least one gold nugget. Since the output can be a really big number, we only ask you to output the remainder of dividing the result by the prime ().
입력
The first line of the input gives the number of test cases, . lines follow. Each line contains a string representing a single test case. The -th character of represents the marking in your notes for the -th kilometer of road, from West to East, using the code explained above.
출력
For each test case, output one line containing Case #x: y, where is the test case number (starting from 1) and is the number of different gold placements that are compatible with your notes, modulo the prime ().
제한
- .
- Each character of is either
<(less than),=(equals),>(greater than),o(lowercase o), or.(period). - At least and not all characters of are
.(period).
힌트
In Sample Case #1, there are three valid placements resulting in roads oo≤>o<, oo≤>oo and o<≤>>o.
In Sample Case #2, there is no valid placement.
In Sample Case #3, the only valid placement results in road o=o. Note that a valid placement must always result in a road containing at least one gold nugget.
In Sample Case #4, all placements are valid. In this case, a placement selecting to leave all the unknown (.) positions empty (without a gold nugget) is valid because the road overall still has one gold nugget in such a placement.