In a C programming Alphabet Animals You are playing a game in which a group of players
Fantastic news! We've Found the answer you've been seeking!
Question:
In a C programming
Transcribed Image Text:
Alphabet Animals You are playing a game in which a group of players take turns saying animal names. The animal name you say when it is your turn must start with the same letter as the previously said animal ends with and it must not have been said previously in this round of the game. If there is no valid name or you cannot come up with one you are eliminated. Given the last animal name said before your turn and a list of all names not yet used, can you make it through this turn? If so, can you make sure to eliminate the next player? Input The first line of input contains a single word, the animal that the previous player just said. The next line contains a single integer n (0 < n ≤ 10³), the number of valid unused animal names. Each of the following lines contains one valid unused animal name. All animal names (including the one the previous player said) are unique and consist of at least 1 and at most 20 lower case letters 'a'-'z'. Output If there is any animal name you can play that eliminates the next player, output the first such name from the input list, followed by an exclamation mark. Otherwise, if there is any animal name that you can play, output the first such name. Otherwise, output a question mark (in this case you will just have to make up a fake name in the hope that the others will trust you that this is a real animal). Sample Input 1 pig 2 goat toad Sample Input 2 dog 2 snake emu Sample Input 3 hare 3 bee cat eagle 2 Sample Output 1 goat Solution to Sample Input 1 by Kuebi via Wikimedia Commons, cc by-s Sample Output 2 ? Sample Output 3 eagle! Alphabet Animals You are playing a game in which a group of players take turns saying animal names. The animal name you say when it is your turn must start with the same letter as the previously said animal ends with and it must not have been said previously in this round of the game. If there is no valid name or you cannot come up with one you are eliminated. Given the last animal name said before your turn and a list of all names not yet used, can you make it through this turn? If so, can you make sure to eliminate the next player? Input The first line of input contains a single word, the animal that the previous player just said. The next line contains a single integer n (0 < n ≤ 10³), the number of valid unused animal names. Each of the following lines contains one valid unused animal name. All animal names (including the one the previous player said) are unique and consist of at least 1 and at most 20 lower case letters 'a'-'z'. Output If there is any animal name you can play that eliminates the next player, output the first such name from the input list, followed by an exclamation mark. Otherwise, if there is any animal name that you can play, output the first such name. Otherwise, output a question mark (in this case you will just have to make up a fake name in the hope that the others will trust you that this is a real animal). Sample Input 1 pig 2 goat toad Sample Input 2 dog 2 snake emu Sample Input 3 hare 3 bee cat eagle 2 Sample Output 1 goat Solution to Sample Input 1 by Kuebi via Wikimedia Commons, cc by-s Sample Output 2 ? Sample Output 3 eagle!
Expert Answer:
Answer rating: 100% (QA)
C programming code include include define MAXANIMALLENGTH ... View the full answer
Related Book For
Posted Date:
Students also viewed these electrical engineering questions
-
In C programming language Question 1: Data definitions and Input-Output functions [25] Write a program that stores the mark allocation weights for 4 assessments as shown in the table below in an...
-
In C programming language Decimal xxx is xxxxxxxx binary and XX hexadecimal Ask the user to enter a decimal integer. Find the 2'scomplement of the number. Remember, to get the two's...
-
In C Programming language please 2 Project Description Thirty One, or Scat, is a card game for 2 or more people and isplayed with a standard 52 playing card deck. In Thirty One, Acesare worth 11...
-
Which of the following is true about a statement of cash flows? The statement of cash flows is prepared at the option of management. The statement of cash flows is required by generally-accepted...
-
Refer to Nokias financial statements in Appendix A. Compute its cost of goods available for sale for the year ended December 31, 2009.
-
In a Gallup poll conducted in August 2010, a random sample of n = 1013 American adults were asked Do you approve or disapprove of the way Congress is handling its job? The proportion who said they...
-
The assets, liabilities, stockholders equity, revenues, and expenses of Carter Design Studio, Inc., have the following balances at December 31, 2010, the end of its first year of operation. During...
-
Institutionally Related Foundations. Compass State University Foundation (CSUF) was incorporated as a not-for-profit organization to support a public university in its fund-raising efforts and the...
-
What restrictions apply to the use of the aggregate functions within the SELECT statement? How do nulls affect the aggregate functions? What is the difference between a subquery and a join? Under...
-
Use the construction in the proof of Theorem 1.45 to give the state diagrams of NFAs recognizing the union of the languages described in a. Exercises 1.6a and 1.6b. b. Exercises 1.6c and 1.6f....
-
1) Kylie is an Accountant employed by Number One Pty Ltd. During the FBT year ended 31 March 2021 she was provided with a variety of benefits by the company. Of those benefits listed below which one...
-
Define Reference Pricing and identify what other sector uses reference pricing and how does it benefit the market? Visit CMS and conduct other research. Part 2. Define the concept of "innovation"....
-
Provide a definition of the brokerage function of financial intermediaries. What factors determine the value of brokerage services? What is the risk involved in doing so? Please provide an example...
-
33. The dimensions of Resistance is (1) LMT-A-] (2) [L-2M- T A] (3) [L M- T A] (4) [L MT A]
-
Describe some of the major challenges facing HR professionals with respect to decision-making in the recruitment and selection process. Provide a short and concise answer.
-
Provide 5 examples of when to use team or group incentive programs rather than individual incentive programs?
-
Compute the thrust required for take-off for a 3-spool turbofan given the following data: a) Flight conditions: M = 0.2, T = 288 K, P = 1 bar b) cH = 5, = 0.98, T = 5, f = 0.0177, hp = 45000 kJ/kg...
-
As you rewrite these sentences, replace the cliches and buzzwords with plain language (if you don't recognize any of these terms, you can find definitions online): a. Being a jack-of-all-trades, Dave...
-
Olive Inc., a Canadian company whose functional currency is Canadian dollars, acquired 100% of the outstanding common shares of Oil Ltd. on January 1, 2013. At the date of acquisition, Olive Inc....
-
The Roger family lost everything in a fire in their home at the beginning of December 2012. On December 23, 2012, a fundraiser was held and an anonymous donation was made to the Sunworld charity to...
-
Explain how the adjustment for intragroup transactions affects the calculation of the NCI share of equity.
-
A plot that represents how much of something there is may be misleading if the baseline is not at ______________________. In Exercises 3 and 4, fill in each blank with the appropriate word or phrase.
-
The population of country A is twice as large as the population of country B. True or false: If images are used to represent the populations, both the height and width of the image for country A...
-
If the baseline of a bar graph or time-series plot is not at zero, then the differences may appear to be __________________ than they actually are.
Study smarter with the SolutionInn App