added solution 2.c