Programming contests

50 Programming Exercise for Beginners

January 2, 2019 12:00 AM – December 31, 2019 12:00 AM

Even Number or Consonant

Each card in a deck has an uppercase letter of the English alphabet on one side, and an integer number on the other side. There is exactly one letter and one number on each card. Somebody makes the following statement about this card deck:

If there is an even number on the number side of a card, then its letter side shows a vowel.

To determine whether this statement is true, we obviously have to have a look at the other side of certain cards.

Your task is to write a program that reads data describing one side of the cards and writes to the standard output the minimum number of cards that have to be flipped over in the worst case to be able to determine without any doubt whether the above statement is true for all cards in the deck.

The input sonsists of several test cases. Each line of a test case contains either an uppercase letter of the English alphabet or an integer. Test cases are terminated by a line containing the string „END”. You may assume that each test case contains at least one line describing a card.

For each test case, your program should write a single line with a single integer to the standard output: the minimum number of cards that need to be flipped over.

Sample Input

  1. E
  2. K
  3. 4
  4. 7
  5. END
  6. -1
  7. END
download as text file

Output for Sample Input

  1. 2
  2. 0
download as text file

Possible solutions: main1.c and main2.c.

Acknowledgement This work was supported by the construction EFOP-3.4.3-16-2016-00021. The project was supported by the European Union, co-financed by the European Social Fund.
University of Debrecen; Faculty of Informatics; v. 03/01/2019