problem 2 solved with javascript
problem 3 solved with javascript