302156: CF409I. Feed the Golorp
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Feed the Golorp
题目描述
Golorps are mysterious creatures who feed on variables. Golorp's name is a program in some programming language. Some scientists believe that this language is Befunge; golorps are tantalizingly silent. Variables consumed by golorps can take values from 0 to 9, inclusive. For each golorp its daily diet is defined by its name. Some golorps are so picky that they can't be fed at all. Besides, all golorps are very health-conscious and try to eat as little as possible. Given a choice of several valid sequences of variable values, each golorp will choose lexicographically smallest one. For the purposes of this problem you can assume that a golorp consists of jaws and a stomach. The number of variables necessary to feed a golorp is defined by the shape of its jaws. Variables can get to the stomach only via the jaws. A hungry golorp is visiting you. You know its name; feed it or figure out that it's impossible.输入输出格式
输入格式
The input is a single string (between 13 and 1024 characters long) — the name of the visiting golorp. All names are similar and will resemble the ones given in the samples. The name is guaranteed to be valid.
输出格式
Output lexicographically smallest sequence of variable values fit for feeding this golorp. Values should be listed in the order in which they get into the jaws. If the golorp is impossible to feed, output "false".
输入输出样例
输入样例 #1
?(_-_/___*__):-___>__.
输出样例 #1
0010
输入样例 #2
?(__-_+_/_____):-__>__,_____<__.
输出样例 #2
false
输入样例 #3
?(______________________/____+_______*__-_____*______-___):-__<___,___<____,____<_____,_____<______,______<_______.
输出样例 #3
0250341
输入样例 #4
?(__+___+__-___):-___>__.
输出样例 #4
0101