Problem 5: my soultion