Programming contests

20 Programming Exercise for Beginners

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

Reverse Case

Create a program that transforms the characters read from the standard input so that it changes the capitalization of the letters (from lowercase to uppercase and vice versa) but keeps any other characters unchanged (repeated in the output as they are).

Input Specification

The input contains ASCII characters only.

Sample Input

  1.  Lorem ipsum dolor sit amet, consectetur adipiscing elit.
  2. Aenean ultrices bibendum mollis.
download as text file

Output Specification

The output must contain exactly the same number of characters as the input.

Output for Sample Input

  1.  lOREM IPSUM DOLOR SIT AMET, CONSECTETUR ADIPISCING ELIT.
  2. aENEAN ULTRICES BIBENDUM MOLLIS.
download as text file

Hints and Guide

In this exercise, the length of the input is not specified, but we can do the conversion character by character.

Remember that processing the input character by character could be very slow, thus, instead of the use of the getchar function, it is recommended to use the fgets function with a buffer.

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