题库练习 Luba And The Ticket
← 上一题 下一题 →

A11111 | Luba And The Ticket

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

Luba has a ticket consisting of $6$ digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.

The ticket is considered lucky if the sum of first three digits equals to the sum of last three digits.

输入格式

You are given a string consisting of $6$ characters (all characters are digits from $0$ to $9$ ) — this string denotes Luba's ticket. The ticket can start with the digit $0$ .

输出格式

Print one number — the minimum possible number of digits Luba needs to replace to make the ticket lucky.

输入输出样例

输入 #1
000000
输出 #1
0
输入 #2
123456
输出 #2
2
输入 #3
111000
输出 #3
1
C++ 编辑器
输入
输出