Solving question 16. Simply using indexOf() method of String rather then regex