In this post I will show you my approach to adding reversed numbers.

This problem occurred during the ACM Central European Programming Contest, in Prague in 1998.

## General description of the problem

### Input

The input consists of *N* cases (equal to about 10000). The first line of the input contains only positive integer *N*. Then follow the cases. Each case consists of exactly one line with two positive integers separated by space. These are the reversed numbers you are to add.

### Output

For each case, print exactly one line containing only one integer – the reversed sum of two reversed numbers. Omit any leading zeros in the output.

### Example

## Solution

### Exemplary approach

- In the first line of the input, we put number of the lines to process.
- In the next lines, we put numbers split by space, in which we should reverse order of the digits and then add them.
- In the final step, we should reverse order of the digits in the generated data and write result to the output.

### Proposal of the solution in the Ruby language

*hint: if you cannot see the code below, please disable AdBlock on this site (I don’t have advertisements, but I’m using Gist)*