Added another solution that is optimal in terms of number of words