Back
Close

Calculate the difference

Statement
Find the absolute difference between the numbers formed by the even-indexed digits and odd-indexed digits of the given number.

Input description
An integer [[n]]

Output description
An integer [[res]]

Constraints
[[n]]>=0 [[res]]>=0

Game modes

Test cases
Test 1 Test
Input
2
Output
2

Validator 1 Validator
Input
9
Output
9

Test 2 Test
Input
12
Output
1

Validator 2 Validator
Input
97
Output
2

Test 3 Test
Input
151
Output
6

Validator 3 Validator
Input
768
Output
72

Test 4 Test
Input
15757
Output
122

Validator 4 Validator
Input
59648
Output
474

Test 5 Test
Input
10000
Output
100

Validator 5 Validator
Input
999999
Output
0

Solution language

Solution

Stub generator input