WORDAKSHARI | faceprep

WORDAKSHARI | faceprep

The program for the problem wordakshari is discussed here.

WORDAKSHARI problem


DESCRIPTION:

Antakshari is a popular parlour game played in India. Many word games are similar to Antakshari. One such game is Wordakshari. The game can be played by two or more people. The first player has to recite a word. The last letter of the word is then used by the next player to recite another word, starting with that word. The winner or winning team is decided by a process of elimination. The person or team that cannot come up with a word with the right consonant is eliminated.

The following rules need to be followed while playing this game.

(i) The first word can begin with any letter.

(ii) All other words have to begin with the last letter of the previous word

(iii) No words can be repeated.

Input and Output Format :

  • Input consists of n+1 lines. The first n lines contain strings corresponding to the words in the chain. The last line of input contains the string #### to mark the end of the input.
  • The output consists of the valid Wordakshari chain.


Sample Input:

architect

tailor

referee

electrician

nurse

blacksmith

####

Sample Output:

architect

tailor

referee

electrician

nurse


face prep pro ad banner

Algorithm to solve Wordakshari

  • Input the strings from the user.
  • If the last letter of the former string and the first letter of the latter string are the same, print both strings.
  • Otherwise, display only the former string.
  • Continue the same until all the strings are traversed.


Program to solve the Wordakshari problem

@@coding::1@@


WORDAKSHARI problem

c