Some people like to play a game that constructs a sequence of chemical elements where each element in the sequence begins with the last letter of its predecessor. For example, if a sequence begins with Hydrogen, then the next element must be an element that begins with N, such as Nickel. The element following Nickel must begin with L, such as Lithium. The element sequence that is constructed cannot contain any duplicates. When played alone the goal of the game is to constructed the longest possible sequence of elements. When played with two players, the goal is to select an element that leaves your opponent without an option to add to the sequence.
Write a program that reads the name of an element from the user and uses a recursive function to find the longest sequence of elements that begins with that value. Display the sequence once it has been computed. Ensure that your program responds in a reasonable way if the user does not enter a valid element name.