A solution to POJ 1504, there will be RE if input character by character