#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, ...);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, int, int, int, int, int);
int /*<<< orphan*/ *strchr(char *, char);
int strlen(char *);
int main() {
  int i, ok, abc, de, x, y, z, count = 0;
  char s[20], buf[99];
  scanf("%s", s);
  for (abc = 111; abc <= 999; abc++) {
    for (de = 11; de <= 99; de++) {
      x = abc * (de % 10);
      y = abc * (de / 10);
      z = abc * de;
      sprintf(buf, "%d%d%d%d%d", abc, de, x, y, z);
      ok = 1;
      for (i = 0; i < strlen(buf); i++) {
        if (strchr(s, buf[i]) == NULL)
          ok = 0;
      }
      if (ok) {
        printf("<%d>\n", ++count);
        printf("%5d\nX%4d\n-----\n%5d\n%4d\n-----\n%5d\n\n", abc, de, x, y, z);
      }
    }
  }
  printf("The number of solutions = %d\n", count);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x24(%rbp)
lea    -0x40(%rbp),%rsi
lea    0xe8c(%rip),%rdi
call   1060 <scanf@plt>
movl   $0x6f,-0x10(%rbp)
cmpl   $0x3e7,-0x10(%rbp)
jg     12e3 <main+0x193>
movl   $0xb,-0x14(%rbp)
cmpl   $0x63,-0x14(%rbp)
jg     12d0 <main+0x180>
mov    -0x10(%rbp),%eax
mov    %eax,-0xb8(%rbp)
mov    -0x14(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0xb8(%rbp),%eax
imul   %edx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xb4(%rbp)
mov    -0x14(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xb4(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
imul   -0x14(%rbp),%eax
mov    %eax,-0x20(%rbp)
lea    -0xb0(%rbp),%rdi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    -0x1c(%rbp),%r9d
mov    -0x20(%rbp),%eax
lea    0xdfa(%rip),%rsi
mov    %eax,(%rsp)
call   1070 <sprintf@plt>
movl   $0x1,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xbc(%rbp)
lea    -0xb0(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0xbc(%rbp),%eax
cmp    %ecx,%eax
jge    127d <main+0x12d>
lea    -0x40(%rbp),%rdi
movslq -0x8(%rbp),%rax
movsbl -0xb0(%rbp,%rax,1),%esi
ff
call   1040 <strchr@plt>
cmp    $0x0,%rax
jne    126a <main+0x11a>
movl   $0x0,-0xc(%rbp)
jmp    126f <main+0x11f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    121f <main+0xcf>
cmpl   $0x0,-0xc(%rbp)
je     12bd <main+0x16d>
mov    -0x24(%rbp),%esi
add    $0x1,%esi
mov    %esi,-0x24(%rbp)
lea    0xd77(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x20(%rbp),%r9d
lea    0xd5e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    12c2 <main+0x172>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1194 <main+0x44>
jmp    12d5 <main+0x185>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1180 <main+0x30>
mov    -0x24(%rbp),%esi
lea    0xd4a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
lea    0xe98(%rip),%rdi
lea    0x20(%rsp),%r14
mov    %r14,%rsi
call   1060 <scanf@plt>
mov    $0x6f,%r15d
lea    0x40(%rsp),%rbp
xor    %r12d,%r12d
jmp    11a1 <main+0x51>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%r15d
cmp    $0x3e8,%r15d
je     12a4 <main+0x154>
mov    $0xb,%r13d
mov    %r15d,0x8(%rsp)
jmp    11ef <main+0x9f>
xchg   %ax,%ax
add    $0x1,%r12d
lea    0xe53(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe48(%rip),%rdi
mov    %r15d,%esi
mov    %r13d,%edx
mov    0x14(%rsp),%ecx
mov    %ebx,%r8d
mov    0x10(%rsp),%r9d
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r13d
cmp    $0x64,%r13d
je     1190 <main+0x40>
movzbl %r13b,%eax
imul   $0xcd,%eax,%ebx
shr    $0xb,%ebx
lea    (%rbx,%rbx,1),%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %cl,%al
movzbl %al,%r8d
imul   %r15d,%r8d
imul   %r15d,%ebx
mov    %r13d,%eax
imul   %r15d,%eax
mov    %eax,0x10(%rsp)
mov    %eax,(%rsp)
mov    %rbp,%rdi
lea    0xddb(%rip),%rsi
mov    %r15d,%edx
mov    %r13d,%ecx
mov    %r8d,0x14(%rsp)
mov    %ebx,%r9d
call   1070 <sprintf@plt>
mov    %rbp,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    11b0 <main+0x60>
mov    %rbx,0x18(%rsp)
mov    %r12d,0xc(%rsp)
mov    $0x1,%r12d
xor    %ebx,%ebx
xor    %r15d,%r15d
movsbl 0x40(%rsp,%rbx,1),%esi
mov    %r14,%rdi
call   1040 <strchr@plt>
test   %rax,%rax
cmove  %r15d,%r12d
add    $0x1,%rbx
mov    %rbp,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     1260 <main+0x110>
test   %r12d,%r12d
mov    0xc(%rsp),%r12d
mov    0x8(%rsp),%r15d
mov    0x18(%rsp),%rbx
jne    11b0 <main+0x60>
jmp    11e5 <main+0x95>
lea    0xd8c(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [11 x i8] c"%d%d%d%d%d\00"
@.str.2 = [6 x i8] c"<%d>\0A\00"
@.str.3 = [35 x i8] c"%5d\0AX%4d\0A-----\0A%5d\0A%4d\0A-----\0A%5d\0A\0A\00"
@.str.4 = [30 x i8] c"The number of solutions = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [20 x i8]
%11 = alloca [99 x i8]
store i32 0, i32* %1
store i32 0, i32* %9
%12 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %12)
store i32 111, i32* %4
br label %14
14: ; preds = %76, %0
%15 = load i32, i32* %4
%16 = icmp sle i32 %15, 999
br i1 %16, label %17, label %79
17: ; preds = %14
store i32 11, i32* %5
br label %18
18: ; preds = %72, %17
%19 = load i32, i32* %5
%20 = icmp sle i32 %19, 99
br i1 %20, label %21, label %75
21: ; preds = %18
%22 = load i32, i32* %4
%23 = load i32, i32* %5
%24 = srem i32 %23, 10
%25 = mul nsw i32 %22, %24
store i32 %25, i32* %6
%26 = load i32, i32* %4
%27 = load i32, i32* %5
%28 = sdiv i32 %27, 10
%29 = mul nsw i32 %26, %28
store i32 %29, i32* %7
%30 = load i32, i32* %4
%31 = load i32, i32* %5
%32 = mul nsw i32 %30, %31
store i32 %32, i32* %8
%33 = getelementptr inbounds [99 x i8], [99 x i8]* %11, i64 0, i64 0
%34 = load i32, i32* %4
%35 = load i32, i32* %5
%36 = load i32, i32* %6
%37 = load i32, i32* %7
%38 = load i32, i32* %8
%39 = call i32 @sprintf(i8* %33, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %34, i32 %35, i32 %36, i32 %37, i32 %38)
store i32 1, i32* %3
store i32 0, i32* %2
br label %40
40: ; preds = %55, %21
%41 = load i32, i32* %2
%42 = getelementptr inbounds [99 x i8], [99 x i8]* %11, i64 0, i64 0
%43 = call i32 @strlen(i8* %42)
%44 = icmp slt i32 %41, %43
br i1 %44, label %45, label %58
45: ; preds = %40
%46 = getelementptr inbounds [20 x i8], [20 x i8]* %10, i64 0, i64 0
%47 = load i32, i32* %2
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds [99 x i8], [99 x i8]* %11, i64 0, i64 %48
%50 = load i8, i8* %49
%51 = call i32* @strchr(i8* %46, i8 signext %50)
%52 = icmp eq i32* %51, null
br i1 %52, label %53, label %54
53: ; preds = %45
store i32 0, i32* %3
br label %54
54: ; preds = %53, %45
br label %55
55: ; preds = %54
%56 = load i32, i32* %2
%57 = add nsw i32 %56, 1
store i32 %57, i32* %2
br label %40
58: ; preds = %40
%59 = load i32, i32* %3
%60 = icmp ne i32 %59, 0
br i1 %60, label %61, label %71
61: ; preds = %58
%62 = load i32, i32* %9
%63 = add nsw i32 %62, 1
store i32 %63, i32* %9
%64 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %63)
%65 = load i32, i32* %4
%66 = load i32, i32* %5
%67 = load i32, i32* %6
%68 = load i32, i32* %7
%69 = load i32, i32* %8
%70 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i32 %65, i32 %66, i32 %67, i32 %68, i32 %69)
br label %71
71: ; preds = %61, %58
br label %72
72: ; preds = %71
%73 = load i32, i32* %5
%74 = add nsw i32 %73, 1
store i32 %74, i32* %5
br label %18
75: ; preds = %18
br label %76
76: ; preds = %75
%77 = load i32, i32* %4
%78 = add nsw i32 %77, 1
store i32 %78, i32* %4
br label %14
79: ; preds = %14
%80 = load i32, i32* %9
%81 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i32 %80)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [11 x i8] c"%d%d%d%d%d\00"
@.str.2 = [6 x i8] c"<%d>\0A\00"
@.str.3 = [35 x i8] c"%5d\0AX%4d\0A-----\0A%5d\0A%4d\0A-----\0A%5d\0A\0A\00"
@.str.4 = [30 x i8] c"The number of solutions = %d\0A\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = alloca [99 x i8]
%3 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [99 x i8], [99 x i8]* %2, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
br label %6
6: ; preds = %0, %45
%7 = phi i32 [ 0, %0 ], [ %42, %45 ]
%8 = phi i32 [ 111, %0 ], [ %46, %45 ]
br label %9
9: ; preds = %6, %41
%10 = phi i32 [ %7, %6 ], [ %42, %41 ]
%11 = phi i32 [ 11, %6 ], [ %43, %41 ]
%12 = trunc i32 %11 to i8
%13 = urem i8 %12, 10
%14 = zext i8 %13 to i32
%15 = mul nsw i32 %8, %14
%16 = udiv i8 %12, 10
%17 = zext i8 %16 to i32
%18 = mul nuw nsw i32 %8, %17
%19 = mul nuw nsw i32 %11, %8
%20 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %8, i32 %11, i32 %15, i32 %18, i32 %19)
%21 = call i32 @strlen(i8* %4)
%22 = icmp sgt i32 %21, 0
br i1 %22, label %23, label %37
23: ; preds = %9, %23
%24 = phi i64 [ %31, %23 ], [ 0, %9 ]
%25 = phi i32 [ %30, %23 ], [ 1, %9 ]
%26 = getelementptr inbounds [99 x i8], [99 x i8]* %2, i64 0, i64 %24
%27 = load i8, i8* %26
%28 = call i32* @strchr(i8* %3, i8 signext %27)
%29 = icmp eq i32* %28, null
%30 = select i1 %29, i32 0, i32 %25
%31 = add nuw nsw i64 %24, 1
%32 = call i32 @strlen(i8* %4)
%33 = sext i32 %32 to i64
%34 = icmp slt i64 %31, %33
br i1 %34, label %23, label %35
35: ; preds = %23
%36 = icmp eq i32 %30, 0
br i1 %36, label %41, label %37
37: ; preds = %9, %35
%38 = add nsw i32 %10, 1
%39 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i32 %38)
%40 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i32 %8, i32 %11, i32 %15, i32 %18, i32 %19)
br label %41
41: ; preds = %35, %37
%42 = phi i32 [ %38, %37 ], [ %10, %35 ]
%43 = add nuw nsw i32 %11, 1
%44 = icmp eq i32 %43, 100
br i1 %44, label %45, label %9
45: ; preds = %41
%46 = add nuw nsw i32 %8, 1
%47 = icmp eq i32 %46, 1000
br i1 %47, label %48, label %6
48: ; preds = %45
%49 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i32 %42)
ret i32 0
}