Programming contests

50 Programming Exercise for Beginners

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

Newspapers

Write a program that reads from the standard input names of newspapers of up to 20 characters, containing no spaces, as well as a string of exactly 7 characters, until end-of-file (EOF), one newspaper per line. The latter string contains only minus ('-') and plus ('+') characters. The 7 characters indicate the appearance of the newspaper on the seven days of the week: the first character represents Monday, the second Tuesday, the third Wednesday, the fourth Thursday, the fifth Friday, the sixth Saturday, and the seventh Sunday. A minus sign indicates that the newspaper is not published on that day, the plus sign indicates that it is.

Your program should write to the the standard output those days when no newspaper is published. If there is more than one day when no newspaper is published, these days should appear in the traditional Hungarian order of weekdays, but with their English names („Monday”, „Tuesday”, „Wednesday”, „Thursday”, „Friday”, „Saturday”, „Sunday”).

Sample Input

  1. Blikk -+-+-+-
  2. Fules +------
  3. Nepszava +-----+
  4. Metro ++-+-++
download as text file

Output for Sample Input

  1. Wednesday
  2. Friday
download as text file

One possible solution is available in: main.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