Programming contests

50 Programming Exercise for Beginners

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

Framed

Write a program that reads a positive integer (x) and a string of up to 50 characters from the standard input line by line until end-of-file (EOF). The string contains only lowercase letters of the English alphabet.

For each number and string, decide whether the first x characters of the string are the same as the last x characters. If so, write „Good” to the standard output, if not, „Bad”.

Sample Input

  1. 1 aaaaaa
  2. 1 aaabbb
  3. 2 ababab
  4. 2 abaaba
  5. 3 ababa
download as text file

Output for Sample Input

  1. Good
  2. Bad
  3. Good
  4. Bad
  5. Good
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