#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 *, char *);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int a, b, i, j, l = 0, x = 1;
  scanf("%d", &a);
  char str1[a];
  scanf("%s", str1);
  scanf("%d", &b);
  char str2[b];
  scanf("%s", str2);
  char check[a];
  for (j = 0; j < a; j++) {
    if (str1[j] == str2[j]) {
      x = 1;
    } else {
      x = 0;
      break;
    }
  }
  for (i = 0; i < a; i++) {
    if (x == 1 && str1[i] == str2[a + i]) {
      check[i] = str1[i];
    } else {
      check[i] = '\0';
      break;
    }
  }
  printf("%s", check);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
lea    0xebc(%rip),%rdi
mov    %rdi,-0x68(%rbp)
xor    %eax,%eax
mov    %al,-0x51(%rbp)
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x51(%rbp),%al
mov    -0x8(%rbp),%ecx
mov    %rsp,%rdx
mov    %rdx,-0x28(%rbp)
mov    %rcx,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rsi
sub    %rdx,%rsi
mov    %rsi,-0x70(%rbp)
mov    %rsi,%rsp
mov    %rcx,-0x30(%rbp)
lea    0xe7d(%rip),%rdi
mov    %rdi,-0x60(%rbp)
call   1040 <scanf@plt>
mov    -0x68(%rbp),%rdi
mov    -0x51(%rbp),%al
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x60(%rbp),%rdi
mov    -0x51(%rbp),%al
mov    -0xc(%rbp),%ecx
mov    %rcx,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rsi
sub    %rdx,%rsi
mov    %rsi,-0x50(%rbp)
mov    %rsi,%rsp
mov    %rcx,-0x38(%rbp)
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1247 <main+0x127>
mov    -0x50(%rbp),%rcx
mov    -0x70(%rbp),%rax
movslq -0x14(%rbp),%rdx
movsbl (%rax,%rdx,1),%eax
movslq -0x14(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jne    1228 <main+0x108>
movl   $0x1,-0x1c(%rbp)
jmp    1234 <main+0x114>
movl   $0x0,-0x1c(%rbp)
jmp    1247 <main+0x127>
jmp    1239 <main+0x119>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11f0 <main+0xd0>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12c8 <main+0x1a8>
cmpl   $0x1,-0x1c(%rbp)
jne    12a4 <main+0x184>
mov    -0x50(%rbp),%rcx
mov    -0x70(%rbp),%rax
movslq -0x10(%rbp),%rdx
movsbl (%rax,%rdx,1),%eax
mov    -0x8(%rbp),%edx
add    -0x10(%rbp),%edx
movslq %edx,%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jne    12a4 <main+0x184>
mov    -0x48(%rbp),%rax
mov    -0x70(%rbp),%rcx
movslq -0x10(%rbp),%rdx
mov    (%rcx,%rdx,1),%dl
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
jmp    12b5 <main+0x195>
mov    -0x48(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    12c8 <main+0x1a8>
jmp    12ba <main+0x19a>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    124e <main+0x12e>
mov    -0x48(%rbp),%rsi
lea    0xd30(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xeca(%rip),%rbx
lea    -0x24(%rbp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %rsp,%r12
mov    -0x24(%rbp),%eax
mov    %rsp,%r14
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
lea    0xea1(%rip),%r15
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    -0x28(%rbp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    -0x28(%rbp),%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    -0x24(%rbp),%edi
mov    %rsp,%rsi
lea    0xf(%rdi),%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%rsi
mov    %rsi,%rsp
test   %edi,%edi
jle    1220 <main+0x100>
mov    (%r14),%cl
mov    $0x1,%al
cmp    (%rbx),%cl
jne    11ec <main+0xcc>
mov    $0x1,%edx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rdx,%rcx
cmp    %rdx,%rdi
je     11e6 <main+0xc6>
movzbl (%r14,%rcx,1),%eax
lea    0x1(%rcx),%rdx
cmp    (%rbx,%rcx,1),%al
je     11d0 <main+0xb0>
cmp    %rdi,%rcx
setb   %al
test   %edi,%edi
jle    1220 <main+0x100>
add    %rdi,%rbx
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nop
test   %al,%al
jne    121c <main+0xfc>
movzbl (%r14,%rdx,1),%ecx
cmp    (%rbx,%rdx,1),%cl
jne    121c <main+0xfc>
mov    %cl,(%rsi,%rdx,1)
add    $0x1,%rdx
cmp    %rdx,%rdi
jne    1200 <main+0xe0>
jmp    1220 <main+0x100>
movb   $0x0,(%rsi,%rdx,1)
lea    0xddc(%rip),%rdi
call   1030 <printf@plt>
mov    %r12,%rsp
xor    %eax,%eax
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\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 i8*
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
store i32 0, i32* %1
store i32 0, i32* %6
store i32 1, i32* %7
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%13 = load i32, i32* %2
%14 = zext i32 %13 to i64
%15 = call i8* @llvm.stacksave()
store i8* %15, i8** %8
%16 = alloca i8, i64 %14
store i64 %14, i64* %9
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%19 = load i32, i32* %3
%20 = zext i32 %19 to i64
%21 = alloca i8, i64 %20
store i64 %20, i64* %10
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %21)
%23 = load i32, i32* %2
%24 = zext i32 %23 to i64
%25 = alloca i8, i64 %24
store i64 %24, i64* %11
store i32 0, i32* %5
br label %26
26: ; preds = %45, %0
%27 = load i32, i32* %5
%28 = load i32, i32* %2
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %48
30: ; preds = %26
%31 = load i32, i32* %5
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %16, i64 %32
%34 = load i8, i8* %33
%35 = sext i8 %34 to i32
%36 = load i32, i32* %5
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8, i8* %21, i64 %37
%39 = load i8, i8* %38
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %35, %40
br i1 %41, label %42, label %43
42: ; preds = %30
store i32 1, i32* %7
br label %44
43: ; preds = %30
store i32 0, i32* %7
br label %48
44: ; preds = %42
br label %45
45: ; preds = %44
%46 = load i32, i32* %5
%47 = add nsw i32 %46, 1
store i32 %47, i32* %5
br label %26
48: ; preds = %43, %26
store i32 0, i32* %4
br label %49
49: ; preds = %83, %48
%50 = load i32, i32* %4
%51 = load i32, i32* %2
%52 = icmp slt i32 %50, %51
br i1 %52, label %53, label %86
53: ; preds = %49
%54 = load i32, i32* %7
%55 = icmp eq i32 %54, 1
br i1 %55, label %56, label %78
56: ; preds = %53
%57 = load i32, i32* %4
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds i8, i8* %16, i64 %58
%60 = load i8, i8* %59
%61 = sext i8 %60 to i32
%62 = load i32, i32* %2
%63 = load i32, i32* %4
%64 = add nsw i32 %62, %63
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds i8, i8* %21, i64 %65
%67 = load i8, i8* %66
%68 = sext i8 %67 to i32
%69 = icmp eq i32 %61, %68
br i1 %69, label %70, label %78
70: ; preds = %56
%71 = load i32, i32* %4
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds i8, i8* %16, i64 %72
%74 = load i8, i8* %73
%75 = load i32, i32* %4
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds i8, i8* %25, i64 %76
store i8 %74, i8* %77
br label %82
78: ; preds = %56, %53
%79 = load i32, i32* %4
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds i8, i8* %25, i64 %80
store i8 0, i8* %81
br label %86
82: ; preds = %70
br label %83
83: ; preds = %82
%84 = load i32, i32* %4
%85 = add nsw i32 %84, 1
store i32 %85, i32* %4
br label %49
86: ; preds = %78, %49
%87 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %25)
store i32 0, i32* %1
%88 = load i8*, i8** %8
%89 = load i32, i32* %1
ret i32 %89
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = zext i32 %6 to i64
%8 = call i8* @llvm.stacksave()
%9 = alloca i8, i64 %7
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%12 = load i32, i32* %2
%13 = zext i32 %12 to i64
%14 = alloca i8, i64 %13
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %14)
%16 = load i32, i32* %1
%17 = zext i32 %16 to i64
%18 = alloca i8, i64 %17
%19 = icmp sgt i32 %16, 0
br i1 %19, label %20, label %57
20: ; preds = %0
%21 = zext i32 %16 to i64
%22 = load i8, i8* %9
%23 = load i8, i8* %14
%24 = icmp eq i8 %22, %23
br i1 %24, label %25, label %37
25: ; preds = %20, %28
%26 = phi i64 [ %34, %28 ], [ 1, %20 ]
%27 = icmp eq i64 %26, %17
br i1 %27, label %35, label %28
28: ; preds = %25
%29 = getelementptr inbounds i8, i8* %9, i64 %26
%30 = load i8, i8* %29
%31 = getelementptr inbounds i8, i8* %14, i64 %26
%32 = load i8, i8* %31
%33 = icmp eq i8 %30, %32
%34 = add nuw nsw i64 %26, 1
br i1 %33, label %25, label %35
35: ; preds = %25, %28
%36 = icmp ult i64 %26, %21
br label %37
37: ; preds = %35, %20
%38 = phi i1 [ true, %20 ], [ %36, %35 ]
br i1 %19, label %39, label %57
39: ; preds = %37
%40 = zext i32 %16 to i64
br label %41
41: ; preds = %39, %50
%42 = phi i64 [ 0, %39 ], [ %52, %50 ]
br i1 %38, label %54, label %43
43: ; preds = %41
%44 = getelementptr inbounds i8, i8* %9, i64 %42
%45 = load i8, i8* %44
%46 = add nuw nsw i64 %42, %40
%47 = getelementptr inbounds i8, i8* %14, i64 %46
%48 = load i8, i8* %47
%49 = icmp eq i8 %45, %48
br i1 %49, label %50, label %54
50: ; preds = %43
%51 = getelementptr inbounds i8, i8* %18, i64 %42
store i8 %45, i8* %51
%52 = add nuw nsw i64 %42, 1
%53 = icmp eq i64 %52, %17
br i1 %53, label %57, label %41
54: ; preds = %43, %41
%55 = and i64 %42, 4294967295
%56 = getelementptr inbounds i8, i8* %18, i64 %55
store i8 0, i8* %56
br label %57
57: ; preds = %50, %0, %37, %54
%58 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %18)
ret i32 0
}