Possible solution for Problem 2 for getting a matching pair of socks of each color