Added a solution

I added a solution to the problem that I tested and found out that it
works perfectly.