Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a function that takes a single input, a person's name, and returns a single output, a string array containing the two possible favourite squishmallows.
Write a function that takes a single input, a person's name, and returns a single output, a string array containing the two possible favourite squishmallows.
The squishmallows should be taken from the list squishmallows.txt that is provided alongside this question. All squishmallows have names of the form X the Y and you should return the full name.
To determine the favourite squishmallows you should consider each squishmallow as being named X the Y and then find the squishmallows who's Y part of the name is alphabetically nearest above, and nearest below, the name of the person provided.
So for example if the name is "Ian" you should return Amaro the Hyena", "Glady the Ice Cream" because "Husky" is alphabetically closest to Ian below, and "Ice Cream" is alphabetically closest above.
Some squishmallows were removed from the list to avoid duplicate vocations, or if they did not have a name of the form X the Y We also will not ask for names that are alphabetically before the first Y or after the last.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started