Programming contests

DEIK Regionális Programozó Csapatverseny, középiskolai kategória, 2022. december 4.

December 4, 2022 10:00 AM – December 4, 2022 3:15 PM


During the age of typewriters some newspaper editors inserted a couple, seemingly gibberish code at the bottom of each page, which the readers were able to decode and type in with their typewriters. The result was a funny ASCII art (an image created by using characters only). Your task is to decode a character sequence and get the corresponding ASCII art by using the codetable below.

  Every code is created by using the following units:
  n(char): repeating the single (char) n number of times. For example 5L -> LLLLL. You may suppose that n is a positive integer.
  sp: single space
  bS: backslash - \
  sQ: single quote - '
  nl: new line character
  Note: there are no integers before the nl notation, thus it always mean a single new line character. However the sp, bS, sQ characters can be repeated multiple times, thus a number can appear before them.


The input is a single line which contains the units of the code separated by a single space character.


The output is the (maybe multi-line) drawing corresponding to the given code.


  1. The number of the code-units is between 5 and 1000;
  2. Every "multiplier" is at most 500;
  3. There is no "double quotes" in the code (but two single quotes are possible as 2sQ);
  4. The code contains at least one nl character.


  1. 1sp 1/ 1bS 1_ 1/ 1bS nl 1( 1sp 1o 1. 1o 1sp 1) nl 1sp 1> 1sp 1^ 1sp 1< nl 2sp 3|
download as text file Output:
  1.  /\_/\
  2. ( o.o )
  3.  > ^ <
  4.   |||
download as text file
University of Debrecen; Faculty of Informatics; v. 03/01/2019