Hello and welcome to the challenge!
The king wants to give for his son the longest name (or precisely: sequence of names) possible. Unfortunately, he can use only three names of the sequence accepted by the queen, and they should be a subsequence of that sequence (queens have high demands). Write a code which will help the king solve his problem.
Have fun and good luck! :)