problem 2 in go
problem 3 in go