Question 1
Study the pattern:
Input: elephant cat dog ant
Output: ant cat dog elephant
Now, what will be the output for:
Input: hi butterfly to elephant
The machine applies 'length_sort' rule.
hi butterfly to elephant → hi to elephant butterfly
hi butterfly to elephant → hi to elephant butterfly