package unit3;
import java.util.Scanner;
public class ShuShiQuestion {
public static void main(String args[]) {
Scanner input = new Scanner(System.in);
int number = input.nextInt();
String check = ""+number;
int counts = 0;
for(int i = 111;i <= 999;i++) {
for(int n = 11;n <= 99;n++) {
int numbers = i*n;
String token = ""+i+n+i*(n%10)+i*(n/10)+numbers; //将两个乘数、竖式两个过程、结果保留到一个字符串中
int count = 0; //记录存在输入字符中的字符的个数
for(int k = 0;k < token.length();k++) { //检查每一个字符是否都在输入字符串中,类似于实例程序中的strchr(s,buf[i])函数
int key = 0;
for(int m = 0;m < check.length();m++) {
if(token.charAt(k) == check.charAt(m)) {
key = 1;
}
}
if(key == 1) {
count++;
}
}
if(count == token.length()) { //每一个字符都属于输入字符串,输出
counts++;
System.out.printf("%5d\n*%4d\n-----\n%5d\n%4d\n-----\n%5d\n\n",i,n,i*(n%10),i*(n/10),i*n);
}
}
}
System.out.print("The number of solutions: "+counts);
}
}