Computer programming - Homework 3

Please submit on https://cv.upt.ro by Friday 8am.

Balanced parantheses
A string of parantheses is balanced if it is empty or has the form (s1)s2 where s1 and s2 are strings of balanced parantheses.
Each balanced string is given a number: N(empty) = 0, N((s1)s2) = 2N(s1)(2N(s2)+1).
a) Write a function that prints the string of balanced parantheses for an unsigned number given as parameter.
b) Write a function that reads a string of balanced parantheses from input (until the first character that does not match) and returns the number corresponding to the string.

Marius Minea
Last modified: Tue Oct 11 12:45:00 EEST 2016