#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 */
scalar_t__ isSentence(char *, int /*<<< orphan*/, int, int **);
int /*<<< orphan*/ memset(int **, int, int);
int /*<<< orphan*/ printf(char *);
scalar_t__ scanf(char *, char *);
scalar_t__ strlen(char *);
int main(void) {
  char str[256 + 1];
  int memoTable[256][256];
  while (scanf("%s", str) > 0) {
    memset(memoTable, -1, 256 * 256 * sizeof(int));
    if (isSentence(str, 0, (int)strlen(str) - 1, memoTable))
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40120,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x110(%rbp),%rsi
lea    0xe90(%rip),%rdi
call   1070 <scanf@plt>
cmp    $0x0,%rax
jle    11f5 <main+0xa5>
lea    -0x40110(%rbp),%rdi
mov    $0xffffffff,%esi
mov    $0x40000,%edx
call   1060 <memset@plt>
lea    -0x110(%rbp),%rax
mov    %rax,-0x40118(%rbp)
lea    -0x110(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x40118(%rbp),%rdi
mov    %eax,%edx
sub    $0x1,%edx
lea    -0x40110(%rbp),%rcx
xor    %esi,%esi
call   1030 <isSentence@plt>
cmp    $0x0,%rax
je     11e4 <main+0x94>
lea    0xe29(%rip),%rdi
call   1050 <printf@plt>
jmp    11f0 <main+0xa0>
lea    0xe1d(%rip),%rdi
call   1050 <printf@plt>
jmp    1162 <main+0x12>
xor    %eax,%eax
add    $0x40120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x40110,%rsp
lea    0xe99(%rip),%rdi
mov    %rsp,%rsi
call   1070 <scanf@plt>
test   %rax,%rax
jle    11e9 <main+0x99>
lea    0x110(%rsp),%r14
mov    %rsp,%rbx
lea    0xe7d(%rip),%r12
lea    0xe79(%rip),%r13
lea    0xe6c(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    $0xffffffff,%esi
mov    $0x40000,%edx
call   1060 <memset@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
lea    -0x1(%rax),%edx
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r14,%rcx
call   1040 <isSentence@plt>
test   %rax,%rax
mov    %r13,%rdi
cmove  %r12,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
test   %rax,%rax
jg     11a0 <main+0x50>
xor    %eax,%eax
add    $0x40110,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [5 x i8] c"YES\0A\00"
@.str.2 = [4 x i8] c"NO\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [257 x i8]
%3 = alloca [256 x [256 x i32]]
store i32 0, i32* %1
br label %4
4: ; preds = %25, %0
%5 = getelementptr inbounds [257 x i8], [257 x i8]* %2, i64 0, i64 0
%6 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = icmp sgt i64 %6, 0
br i1 %7, label %8, label %26
8: ; preds = %4
%9 = getelementptr inbounds [256 x [256 x i32]], [256 x [256 x i32]]* %3, i64 0, i64 0
%10 = bitcast [256 x i32]* %9 to i32**
%11 = call i32 @memset(i32** %10, i32 -1, i32 262144)
%12 = getelementptr inbounds [257 x i8], [257 x i8]* %2, i64 0, i64 0
%13 = getelementptr inbounds [257 x i8], [257 x i8]* %2, i64 0, i64 0
%14 = call i64 @strlen(i8* %13)
%15 = trunc i64 %14 to i32
%16 = sub nsw i32 %15, 1
%17 = getelementptr inbounds [256 x [256 x i32]], [256 x [256 x i32]]* %3, i64 0, i64 0
%18 = bitcast [256 x i32]* %17 to i32**
%19 = call i64 @isSentence(i8* %12, i32 0, i32 %16, i32** %18)
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %8
%22 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %25
23: ; preds = %8
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %25
25: ; preds = %23, %21
br label %4
26: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@str = [3 x i8] c"NO\00"
@str.3 = [4 x i8] c"YES\00"
define i32 @main() {
%1 = alloca [257 x i8]
%2 = alloca [256 x [256 x i32]]
%3 = getelementptr inbounds [257 x i8], [257 x i8]* %1, i64 0, i64 0
%4 = bitcast [256 x [256 x i32]]* %2 to i8*
%5 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%6 = icmp sgt i64 %5, 0
br i1 %6, label %7, label %20
7: ; preds = %0
%8 = bitcast [256 x [256 x i32]]* %2 to i32**
br label %9
9: ; preds = %7, %9
%10 = call i32 @memset(i32** %8, i32 -1, i32 262144)
%11 = call i64 @strlen(i8* %3)
%12 = trunc i64 %11 to i32
%13 = add nsw i32 %12, -1
%14 = call i64 @isSentence(i8* %3, i32 0, i32 %13, i32** %8)
%15 = icmp eq i64 %14, 0
%16 = select i1 %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @str.3, i64 0, i64 0)
%17 = call i32 @puts(i8* dereferenceable(1) %16)
%18 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%19 = icmp sgt i64 %18, 0
br i1 %19, label %9, label %20
20: ; preds = %9, %0
ret i32 0
}