solved problem 42 inc,java,python