Problem 135 solution in C