Problem Statement | |||||||||||||
Problem writers for TopCoder have to include constraints on their problems so that unexpected inputs don't get fed into unsuspecting code. Therefore, all problems written for TopCoder require a checkData function that takes the same parameters as the solution and prints an error message if the inputs violate the constraints. You're writing a nasty little problem about dot notation (used in one of your favorite logic textbooks written by Quine) and you need to write a checkData function to make sure that what's being passed into the problem is indeed in dot notation, and is within allowable string length, which is between 1 and 25 characters, inclusive. Dot notation is described in Backus-Naur form below; it tells you precisely how to construct all dot notations from their constituent parts(double quotes are added for clarity, otherwise double quotes would be allowed in dot notation, and we don't want that.): <DotNotation> := <Number> | <DotNotation><Dots><Operator><Dots><Number> <Dots> := "" | <Dots>"." <Operator> := exactly one of "+-*/" <Number> := exactly one of "0123456789" This reads as follows: Any single digit is a <DotNotation> because any digit by itself is a <Number>. Also, if you take any number of periods (<Dots>), a single <Operator> from line 3, any number of additional periods, and another single digit, you can concatenate that to any <DotNotation> and that new string would also be a <DotNotation>. For example, "5" is a <DotNotation>, if you attach ".+.7" to it it becomes another <DotNotation>, and if you attach "*..3" to that ("5.+.7*..3"), that also would be a <DotNotation>. You will write a function called myCheckData (can't be called checkData, for this problem needs its own) that takes a String that may or may not be in dot notation, and returns a String about its validity. Check the input as follows below:
| |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | dotForm will contain between 1 and 50 characters inclusive. | ||||||||||||
- | dotForm will consist solely of ASCII characters in the range 32-126 inclusive. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
| |||||||||||||
4) | |||||||||||||
|