#C646. Minimum Changes to Palindrome

    ID: 50222 Type: Default 1000ms 256MiB

Minimum Changes to Palindrome

Minimum Changes to Palindrome

Given a positive integer num consisting of digits from 1 to 9, determine the minimum number of digit changes required to transform num into a palindrome.

A palindrome is a number that reads the same backward as forward. For example, for 12345, changing two digits is sufficient to achieve a palindrome.

Your task is to compute the minimum number of changes to make the given number a palindrome.

inputFormat

The input consists of a single line containing a positive integer num (with digits from 1 to 9). Read the input from standard input (stdin).

outputFormat

Output a single integer representing the minimum number of digit changes needed to convert the given number into a palindrome. Write the output to standard output (stdout).## sample

12321
0