Divisibility by Eight

题意翻译

# 题目描述 给你一个位数不超过 100 的非负整数 N(不含前导 0)。你的任务是判断这个数字能否通过去掉其中的一些位上的数(当然不能去掉全部),使其成为一个能被 8 整除的正整数(不含前导 0)。特别注意:你不能重新排列数字的顺序。 # 输入输出格式 ## 输入 一行,表示正整数 N。保证 N 不超过 100 位。 ## 输出 如果不能达成条件,则输出 “NO”(不含引号)。 如果可以,输出 “YES”,并在第二行输出最终能被 8 整除的那个结果。如果有多解,则输出任意解。 题目贡献人:SSH_oj uid=41262

题目描述

You are given a non-negative integer $ n $ , its decimal representation consists of at most $ 100 $ digits and doesn't contain leading zeroes. Your task is to determine if it is possible in this case to remove some of the digits (possibly not remove any digit at all) so that the result contains at least one digit, forms a non-negative integer, doesn't have leading zeroes and is divisible by 8. After the removing, it is forbidden to rearrange the digits. If a solution exists, you should print it.

输入输出格式

输入格式


The single line of the input contains a non-negative integer $ n $ . The representation of number $ n $ doesn't contain any leading zeroes and its length doesn't exceed $ 100 $ digits.

输出格式


Print "NO" (without quotes), if there is no such way to remove some digits from number $ n $ . Otherwise, print "YES" in the first line and the resulting number after removing digits from number $ n $ in the second line. The printed number must be divisible by $ 8 $ . If there are multiple possible answers, you may print any of them.

输入输出样例

输入样例 #1

3454

输出样例 #1

YES
344

输入样例 #2

10

输出样例 #2

YES
0

输入样例 #3

111111

输出样例 #3

NO