Programming contests

20 Programming Exercise for Beginners

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

Linux REV command

On Unix-like operating systems, the rev command copies the standard input to standard output, reversing the order of characters in every line. Create a program that provides the same functionality.

Input Specification

The input is an ASCII text without any restrictions.

Sample Input

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

Output Specification

For each line of the input, the program must print one line containing the characters in reversed order.

Output for Sample Input

  1. .tile gnicsipida rutetcesnoc ,tema tis rolod muspi meroL
  2. .sillom mudnebib secirtlu naeneA
download as text file

Hints and Guide

Instead of reading individual characters, we recommend to use a buffer filled with the help of the fgets function.

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. 09/30/2024