solved problem 12 with my shit algo