Programming contests

Magas szintű programozási nyelvek 1, 2015. április 15., Sz10 ZH

April 15, 2015 10:05 AM – April 15, 2015 11:45 AM

Extra Spaces

In programming, multiple whitespaces are used only to make the code more readable, so almost all programming languages totally ignore multiple spaces in the code (except for some esoteric ones). In general, there are different types of whitespace characters: space itself, tab, the newline symbol, various control characters, etc. Tabs and spaces bring one of the biggest holy wars, if not the biggest holy war, to a programmer's world as there is no common rule what to use for code indentation — tab or space characters.

In this holy war, you stand for the tab side, and your project code convention requires to use only tabs for code indentation. However, you have recently spotted that someone is using space characters instead. Four spaces and one tab character look the same in our text editor, so you have decided to write a parser that will change all adjacent space characters to one. After that, you would be able to determine the amount of corrupted code.

Input Specification

The number of test cases T (T ≤ 100) is given in the first line of the input. In the first line of each test case, there is an integer N (N ≤ 50). In the next N lines, text that must be processed for extra spaces follow. The maximum line length is 500 characters.

Output Specification

For each test case, output in the fist line “Case T:”, where T is the test case number (starting from 1). The next N lines must contain the input text having no adjacent spaces. Always leave a blank line between tests. Please refer to the sample output for clarity.

Sample Input

  1. 2
  2. 3
  3. Sample test one:
  4.   there was 2 spaces and 
  5. here are also  2  spaces
  6. 2
  7. Sample test two:
  8.      there was 4 spaces
download as text file

Output for Sample Input

  1. Case 1:
  2. Sample test one:
  3.  there was 2 spaces and 
  4. here are also 2 spaces
  5. Case 2:
  6. Sample test two:
  7.  there was 4 spaces
download as text file
University of Debrecen; Faculty of Informatics; v. 03/01/2019