#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 (i = 0; i < a; i++) {
    if (str1[i] == str2[i] && str1[i] == str2[a + i]) {
      check[i] = str1[i];
    } else {
      check[i] = '\0';
      break;
    }
  }
  for (j = 0; j < a; j++) {
    if (str1[j] == str2[j]) {
      x = 1;
    } else {
      x = 0;
      break;
    }
  }
  if (x == 1) {
    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,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1280 <main+0x160>
mov    -0x50(%rbp),%rcx
mov    -0x70(%rbp),%rax
movslq -0x10(%rbp),%rdx
movsbl (%rax,%rdx,1),%eax
movslq -0x10(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jne    125c <main+0x13c>
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    125c <main+0x13c>
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    126d <main+0x14d>
mov    -0x48(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1280 <main+0x160>
jmp    1272 <main+0x152>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11f0 <main+0xd0>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12de <main+0x1be>
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    12bf <main+0x19f>
movl   $0x1,-0x1c(%rbp)
jmp    12cb <main+0x1ab>
movl   $0x0,-0x1c(%rbp)
jmp    12de <main+0x1be>
jmp    12d0 <main+0x1b0>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1287 <main+0x167>
cmpl   $0x1,-0x1c(%rbp)
jne    12f8 <main+0x1d8>
mov    -0x48(%rbp),%rsi
lea    0xd10(%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),%eax
mov    %rsp,%rsi
lea    0xf(%rax),%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%rsi
mov    %rsi,%rsp
test   %eax,%eax
jle    1203 <main+0xe3>
lea    (%rbx,%rax,1),%rdi
xor    %ecx,%ecx
nopl   0x0(%rax)
movzbl (%r14,%rcx,1),%edx
cmp    (%rbx,%rcx,1),%dl
jne    11e1 <main+0xc1>
cmp    (%rdi,%rcx,1),%dl
jne    11e1 <main+0xc1>
mov    %dl,(%rsi,%rcx,1)
add    $0x1,%rcx
cmp    %rcx,%rax
jne    11c0 <main+0xa0>
test   %eax,%eax
jg     11e9 <main+0xc9>
jmp    1203 <main+0xe3>
movb   $0x0,(%rsi,%rcx,1)
test   %eax,%eax
jle    1203 <main+0xe3>
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
movzbl (%r14,%rcx,1),%edx
cmp    (%rbx,%rcx,1),%dl
jne    120f <main+0xef>
add    $0x1,%rcx
cmp    %rcx,%rax
jne    11f0 <main+0xd0>
lea    0xdf9(%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* %4
br label %26
26: ; preds = %69, %0
%27 = load i32, i32* %4
%28 = load i32, i32* %2
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %72
30: ; preds = %26
%31 = load i32, i32* %4
%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* %4
%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 %64
42: ; preds = %30
%43 = load i32, i32* %4
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* %16, i64 %44
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = load i32, i32* %2
%49 = load i32, i32* %4
%50 = add nsw i32 %48, %49
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i8, i8* %21, i64 %51
%53 = load i8, i8* %52
%54 = sext i8 %53 to i32
%55 = icmp eq i32 %47, %54
br i1 %55, label %56, label %64
56: ; preds = %42
%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 = load i32, i32* %4
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i8, i8* %25, i64 %62
store i8 %60, i8* %63
br label %68
64: ; preds = %42, %30
%65 = load i32, i32* %4
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds i8, i8* %25, i64 %66
store i8 0, i8* %67
br label %72
68: ; preds = %56
br label %69
69: ; preds = %68
%70 = load i32, i32* %4
%71 = add nsw i32 %70, 1
store i32 %71, i32* %4
br label %26
72: ; preds = %64, %26
store i32 0, i32* %5
br label %73
73: ; preds = %92, %72
%74 = load i32, i32* %5
%75 = load i32, i32* %2
%76 = icmp slt i32 %74, %75
br i1 %76, label %77, label %95
77: ; preds = %73
%78 = load i32, i32* %5
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i8, i8* %16, i64 %79
%81 = load i8, i8* %80
%82 = sext i8 %81 to i32
%83 = load i32, i32* %5
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds i8, i8* %21, i64 %84
%86 = load i8, i8* %85
%87 = sext i8 %86 to i32
%88 = icmp eq i32 %82, %87
br i1 %88, label %89, label %90
89: ; preds = %77
store i32 1, i32* %7
br label %91
90: ; preds = %77
store i32 0, i32* %7
br label %95
91: ; preds = %89
br label %92
92: ; preds = %91
%93 = load i32, i32* %5
%94 = add nsw i32 %93, 1
store i32 %94, i32* %5
br label %73
95: ; preds = %90, %73
%96 = load i32, i32* %7
%97 = icmp eq i32 %96, 1
br i1 %97, label %98, label %100
98: ; preds = %95
%99 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %25)
br label %100
100: ; preds = %98, %95
store i32 0, i32* %1
%101 = load i8*, i8** %8
%102 = load i32, i32* %1
ret i32 %102
}

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 %52
20: ; preds = %0
%21 = zext i32 %16 to i64
br label %22
22: ; preds = %20, %34
%23 = phi i64 [ 0, %20 ], [ %36, %34 ]
%24 = getelementptr inbounds i8, i8* %9, i64 %23
%25 = load i8, i8* %24
%26 = getelementptr inbounds i8, i8* %14, i64 %23
%27 = load i8, i8* %26
%28 = icmp eq i8 %25, %27
br i1 %28, label %29, label %38
29: ; preds = %22
%30 = add nuw nsw i64 %23, %21
%31 = getelementptr inbounds i8, i8* %14, i64 %30
%32 = load i8, i8* %31
%33 = icmp eq i8 %25, %32
br i1 %33, label %34, label %38
34: ; preds = %29
%35 = getelementptr inbounds i8, i8* %18, i64 %23
store i8 %25, i8* %35
%36 = add nuw nsw i64 %23, 1
%37 = icmp eq i64 %36, %17
br i1 %37, label %41, label %22
38: ; preds = %29, %22
%39 = and i64 %23, 4294967295
%40 = getelementptr inbounds i8, i8* %18, i64 %39
store i8 0, i8* %40
br label %41
41: ; preds = %34, %38
br i1 %19, label %44, label %52
42: ; preds = %44
%43 = icmp eq i64 %51, %17
br i1 %43, label %52, label %44
44: ; preds = %41, %42
%45 = phi i64 [ %51, %42 ], [ 0, %41 ]
%46 = getelementptr inbounds i8, i8* %9, i64 %45
%47 = load i8, i8* %46
%48 = getelementptr inbounds i8, i8* %14, i64 %45
%49 = load i8, i8* %48
%50 = icmp eq i8 %47, %49
%51 = add nuw nsw i64 %45, 1
br i1 %50, label %42, label %54
52: ; preds = %42, %0, %41
%53 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %18)
br label %54
54: ; preds = %44, %52
ret i32 0
}