added solution 3.c