Solved problem 4 in python. 196947th person
solved problem 4 in c++