Computer programming - Homework 4
1.One sentence per line
Write a program that reads a text until EOF and prints it out transformed
with the following three rules:
- any sequence of whitespace is replaced by a single space
- any period (dot) is followed by a newline
- there is no whitespace at the start or end of any line
2. S-expressions
An s-expression is either a word formed of letters, or a sequence of zero
or more s-expressions, separated by whitespace, between parantheses:
(exp1 exp2 ... expn). (These appear in functional languages such as LISP). Extra whitespace before or after each paranthesis is allowed.
Write a program that checks if the input (until EOF) is a valid s-expression.
Marius Minea
Last modified: Tue Oct 20 13:45:00 EEST 2015