CF1562B Scenes From a Memory

题目描述

给出一个正整数 $n$,$n$ 中不包含 $0$。求最大删去多少位使其变成一个合数或 $1$。数据保证一定存在答案。 素数是指除 $1$ 和它本身外没有除数的数。合数是指一个有两个以上除数的数。$1$ 既不是质数也不是合数。

输入格式

第一行一个正整数 $t(1\leq t \leq 10^3)$,表示数据组数。 每组数据第一行一个正整数 $k(1\leq k\leq 50)$,表示数字的位数。 第二行一整正整数 $n(10^{k-1}\leq n \leq 10^{k})$。

输出格式

对于每组数据,第一行输出剩下的数的位数,第二行输出剩下的数。 若有多组解,输出任意一个即可。

说明/提示

In the first test case, you can't delete $ 2 $ digits from the number $ 237 $ , as all the numbers $ 2 $ , $ 3 $ , and $ 7 $ are prime. However, you can delete $ 1 $ digit, obtaining a number $ 27 = 3^3 $ . In the second test case, you can delete all digits except one, as $ 4 = 2^2 $ is a composite number.