#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 *calloc(int, int);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, ...);
int strlen(char *);
int main() {
  char *s = (char *)malloc(512000 * sizeof(char));
  int *weights = calloc(99512000, sizeof(int));
  scanf("%s", s);
  int weights_i = 0;
  int count = 0;
  char previous = 0;
  for (int i = 0; i < strlen(s); ++i) {
    if (previous != s[i]) {
      count = (int)s[i] - 96;
      weights[count] = 1;
      previous = s[i];
    } else {
      count += (int)s[i] - 96;
      weights[count] = 1;
    }
  }
  int n;
  scanf("%d", &n);
  for (int a0 = 0; a0 < n; a0++) {
    int x;
    scanf("%d", &x);
    if (weights[x])
      printf("Yes\n");
    else
      printf("No\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x7d000,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0x5ee6ec0,%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1070 <scanf@plt>
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movb   $0x0,-0x21(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%eax
cmp    %ecx,%eax
jge    124a <main+0xfa>
movsbl -0x21(%rbp),%eax
mov    -0x10(%rbp),%rcx
movslq -0x28(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     1213 <main+0xc3>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
sub    $0x60,%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x21(%rbp)
jmp    1237 <main+0xe7>
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
sub    $0x60,%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
jmp    123c <main+0xec>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    11ab <main+0x5b>
lea    0xdb2(%rip),%rdi
lea    -0x2c(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    12c3 <main+0x173>
lea    0xd8d(%rip),%rdi
lea    -0x34(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
je     12a4 <main+0x154>
lea    0xd6c(%rip),%rdi
call   1040 <printf@plt>
jmp    12b0 <main+0x160>
lea    0xd60(%rip),%rdi
call   1040 <printf@plt>
jmp    12b5 <main+0x165>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1263 <main+0x113>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x7d000,%edi
call   1060 <malloc@plt>
mov    %rax,%r12
mov    $0x5ee6ec0,%edi
mov    $0x4,%esi
call   1050 <calloc@plt>
mov    %rax,%r14
lea    0xe7f(%rip),%rdi
xor    %r15d,%r15d
mov    %r12,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    %r12,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    11e2 <main+0x92>
xor    %r13d,%r13d
xor    %eax,%eax
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl (%r12,%r13,1),%ebp
cmp    %bpl,%al
cmovne %r15d,%ebx
add    %ebp,%ebx
add    $0xffffffa0,%ebx
movslq %ebx,%rax
movl   $0x1,(%r14,%rax,4)
add    $0x1,%r13
mov    %r12,%rdi
call   1040 <strlen@plt>
movslq %eax,%rcx
mov    %ebp,%eax
cmp    %rcx,%r13
jl     11b0 <main+0x60>
lea    0xe1a(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
cmpl   $0x0,(%rsp)
jle    124e <main+0xfe>
lea    0xe03(%rip),%r15
lea    0x4(%rsp),%r12
lea    0xdfa(%rip),%rbx
lea    0xdf6(%rip),%r13
xor    %ebp,%ebp
jmp    122d <main+0xdd>
nopw   0x0(%rax,%rax,1)
call   1030 <puts@plt>
add    $0x1,%ebp
cmp    (%rsp),%ebp
jge    124e <main+0xfe>
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
movslq 0x4(%rsp),%rax
cmpl   $0x0,(%r14,%rax,4)
mov    %rbx,%rdi
je     1220 <main+0xd0>
mov    %r13,%rdi
jmp    1220 <main+0xd0>
xor    %eax,%eax
add    $0x8,%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 = [3 x i8] c"%d\00"
@.str.2 = [5 x i8] c"Yes\0A\00"
@.str.3 = [4 x i8] c"No\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %1
%11 = call i64 @malloc(i32 512000)
%12 = inttoptr i64 %11 to i8*
store i8* %12, i8** %2
%13 = call i32* @calloc(i32 99512000, i32 4)
store i32* %13, i32** %3
%14 = load i8*, i8** %2
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %14)
store i32 0, i32* %4
store i32 0, i32* %5
store i8 0, i8* %6
store i32 0, i32* %7
br label %16
16: ; preds = %63, %0
%17 = load i32, i32* %7
%18 = load i8*, i8** %2
%19 = call i32 @strlen(i8* %18)
%20 = icmp slt i32 %17, %19
br i1 %20, label %21, label %66
21: ; preds = %16
%22 = load i8, i8* %6
%23 = sext i8 %22 to i32
%24 = load i8*, i8** %2
%25 = load i32, i32* %7
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8, i8* %24, i64 %26
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp ne i32 %23, %29
br i1 %30, label %31, label %48
31: ; preds = %21
%32 = load i8*, i8** %2
%33 = load i32, i32* %7
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %32, i64 %34
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = sub nsw i32 %37, 96
store i32 %38, i32* %5
%39 = load i32*, i32** %3
%40 = load i32, i32* %5
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i32, i32* %39, i64 %41
store i32 1, i32* %42
%43 = load i8*, i8** %2
%44 = load i32, i32* %7
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i8, i8* %43, i64 %45
%47 = load i8, i8* %46
store i8 %47, i8* %6
br label %62
48: ; preds = %21
%49 = load i8*, i8** %2
%50 = load i32, i32* %7
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i8, i8* %49, i64 %51
%53 = load i8, i8* %52
%54 = sext i8 %53 to i32
%55 = sub nsw i32 %54, 96
%56 = load i32, i32* %5
%57 = add nsw i32 %56, %55
store i32 %57, i32* %5
%58 = load i32*, i32** %3
%59 = load i32, i32* %5
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds i32, i32* %58, i64 %60
store i32 1, i32* %61
br label %62
62: ; preds = %48, %31
br label %63
63: ; preds = %62
%64 = load i32, i32* %7
%65 = add nsw i32 %64, 1
store i32 %65, i32* %7
br label %16
66: ; preds = %16
%67 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
store i32 0, i32* %9
br label %68
68: ; preds = %85, %66
%69 = load i32, i32* %9
%70 = load i32, i32* %8
%71 = icmp slt i32 %69, %70
br i1 %71, label %72, label %88
72: ; preds = %68
%73 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %10)
%74 = load i32*, i32** %3
%75 = load i32, i32* %10
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds i32, i32* %74, i64 %76
%78 = load i32, i32* %77
%79 = icmp ne i32 %78, 0
br i1 %79, label %80, label %82
80: ; preds = %72
%81 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
br label %84
82: ; preds = %72
%83 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %84
84: ; preds = %82, %80
br label %85
85: ; preds = %84
%86 = load i32, i32* %9
%87 = add nsw i32 %86, 1
store i32 %87, i32* %9
br label %68
88: ; preds = %68
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [3 x i8] c"%d\00"
@str = [3 x i8] c"No\00"
@str.4 = [4 x i8] c"Yes\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = tail call i64 @malloc(i32 512000)
%4 = inttoptr i64 %3 to i8*
%5 = tail call i32* @calloc(i32 99512000, i32 4)
%6 = tail call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%7 = tail call i32 @strlen(i8* %4)
%8 = icmp sgt i32 %7, 0
br i1 %8, label %16, label %9
9: ; preds = %16, %0
%10 = bitcast i32* %1 to i8*
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%12 = load i32, i32* %1
%13 = icmp sgt i32 %12, 0
br i1 %13, label %14, label %33
14: ; preds = %9
%15 = bitcast i32* %2 to i8*
br label %34
16: ; preds = %0, %16
%17 = phi i64 [ %29, %16 ], [ 0, %0 ]
%18 = phi i8 [ %21, %16 ], [ 0, %0 ]
%19 = phi i32 [ %26, %16 ], [ 0, %0 ]
%20 = getelementptr inbounds i8, i8* %4, i64 %17
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp eq i8 %18, %21
%24 = add nsw i32 %22, -96
%25 = select i1 %23, i32 %19, i32 0
%26 = add nsw i32 %24, %25
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i32, i32* %5, i64 %27
store i32 1, i32* %28
%29 = add nuw nsw i64 %17, 1
%30 = tail call i32 @strlen(i8* %4)
%31 = sext i32 %30 to i64
%32 = icmp slt i64 %29, %31
br i1 %32, label %16, label %9
33: ; preds = %34, %9
ret i32 0
34: ; preds = %14, %34
%35 = phi i32 [ 0, %14 ], [ %44, %34 ]
%36 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%37 = load i32, i32* %2
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i32, i32* %5, i64 %38
%40 = load i32, i32* %39
%41 = icmp eq i32 %40, 0
%42 = select i1 %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @str.4, i64 0, i64 0)
%43 = call i32 @puts(i8* dereferenceable(1) %42)
%44 = add nuw nsw i32 %35, 1
%45 = load i32, i32* %1
%46 = icmp slt i32 %44, %45
br i1 %46, label %34, label %33
}