Answer:
# The user in prompted for input and stored in userInput
userInput = str(input("Enter the contact: "))
# The user input is splitted and stored in splitUserInput
# splitUserInput is a list because split returns a list
splitUserInput = userInput.split(" ")
# The user is prompt to enter the search contact
# The search contact will have the first letter capitalize
# should it be entered in lower case all through
searchContact = str(input("Enter the search contact: "))
# loop through the list
for i in range(len(splitUserInput)):
# compare if the string at any value of i
# is the same as the searchContact
# we display the string ahead of it
# by adding 1 to the index
if(splitUserInput[i] == searchContact):
print(splitUserInput[i + 1])
Explanation:
A sample screenshot is attached. The code is written in Python 3 and well commented.
The program prompt the user for input then split the input into a list. It then asked for a contact to search for. It begins looping through the list, if the search contact is found at any index, then it prints what is in front of the index.