Create a program that validates its input. The input is valid if it is true for all the input lines that the line consists of decimal digits only or contains nothing else just lowercase letters.
The input consists of ASCII characters. The length of the input data and the number of input lines are not restricted.
The output consists of a line terminated by a newline character. The line must contains the word
Output for Sample Input
Hints and Guide
We recommend to read the input character by character. Three boolean variable should managed in case when other than a newline character is read from the input:
Any time when a newline character is read from the input, all the variables must be reset to false (0).
Note that we should use integers to store boolean values, hence there is no dedicated Boolean type in the C programming language.
After processing the next character on the input, the program can terminate immediately, recognizing that the input is invalid, if the first two or the third variable is set to true. If there is no more character on the input, then the input is valid.
One possible solution is available in: main.c.
Acknowledgement This work was supported by the construction EFOP-3.4.3-16-2016-00021. The project was supported by the European Union, co-financed by the European Social Fund.
|University of Debrecen; Faculty of Informatics; v. 03/01/2019|