Back
Close

Food Chain

Statement

 Goal

You are given a food chain. You must identify the predators and prey of the species listed. You are given an integer n. Then, you will list the members of the food chain s. String s will be repeated n times, representing each animals/strings in order from most dominant to least dominant. Then, a string t, will be the animal you will choose to evaluate. In your evaluation, you will identify the animals/strings with more dominance and less dominance, and print them in the order of the list.

In this program, you must select the node/element given as input t from all other inputs prespecified as s, and print each of the elements above and below t in the list (note you must print out on a new line).
Input
The integer n, followed by n number of strings s.
The string t.
Output
The items above and below that specified string t. If there are duplicate values of string t in the list, print the first appearance of string t.
Constraints
1 <= n <= 100
Strings can be of any length, string t is always one of string s.
Example
Input
3
Shark
Frog
Bee
Frog
Output
Shark
Bee

Game modes
Shortest

Test cases
Test 1 Test
Input
3 Shark Frog Bee Frog
Output
Shark Bee

Validator 1 Validator
Input
4 Bird Worm Leaf Soil Bird
Output
Worm Leaf Soil

Test 2 Test
Input
6 a s d f g h d
Output
a s f g h

Validator 2 Validator
Input
8 AlecMan Is So Freaking Sweaty Lol bruh xd xd
Output
AlecMan Is So Freaking Sweaty Lol bruh

Test 3 Test
Input
12 Alecman if you see this know that you are epic :) :) :)
Output
Alecman if you see this know that you are epic :)

Validator 3 Validator
Input
13 La L la la la la la la la la la la la la
Output
La L la la la la la la la la la la

Test 4 Test
Input
14 Did you hear that? said Mia 'No' I did not said mr chicken nugget Mia
Output
Did you hear that? said 'No' I did not said mr chicken nugget

Validator 4 Validator
Input
12 adwf adsf adsf adsf adsf adsf adsf asdf fda fda fsa wver adwf
Output
adsf adsf adsf adsf adsf adsf asdf fda fda fsa wver

Solution language

Solution

Stub generator input