this is for problem 138.....good solution