#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 *, ...);
int strlen(char *);
int main() {
  int testcase = 0;
  scanf("%d", &testcase);
  while (testcase--) {
    int i = 0;
    int count = 0;
    char word[10001];
    char word1[10001];
    int hashtable[26] = {0};
    scanf("%s", word);
    scanf("%s", word1);
    for (i = 0; i < 26; i++)
      hashtable[i] = 0;
    for (i = 0; i < strlen(word); i++) {
      int temp = (int)word[i] - 97;
      hashtable[temp]++;
    }
    for (i = 0; i < strlen(word1); i++) {
      int temp = (int)word1[i] - 97;
      if (hashtable[temp] > 0)
        hashtable[temp]--;
      else
        count++;
    }
    for (i = 0; i < 26; i++) {
      count = count + hashtable[i];
    }
    printf("%d\n", count);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4ed0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xea0(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     1332 <main+0x1f2>
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    -0x4ec0(%rbp),%rdi
xor    %esi,%esi
mov    $0x68,%edx
call   1050 <memset@plt>
lea    -0x2730(%rbp),%rsi
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    -0x4e50(%rbp),%rsi
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x1a,-0xc(%rbp)
jge    11f8 <main+0xb8>
movslq -0xc(%rbp),%rax
movl   $0x0,-0x4ec0(%rbp,%rax,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11d1 <main+0x91>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4ecc(%rbp)
lea    -0x2730(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x4ecc(%rbp),%eax
cmp    %ecx,%eax
jge    125f <main+0x11f>
movslq -0xc(%rbp),%rax
movsbl -0x2730(%rbp,%rax,1),%eax
ff
sub    $0x61,%eax
mov    %eax,-0x4ec4(%rbp)
movslq -0x4ec4(%rbp),%rax
mov    -0x4ec0(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x4ec0(%rbp,%rax,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11ff <main+0xbf>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4ed0(%rbp)
lea    -0x4e50(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x4ed0(%rbp),%eax
cmp    %ecx,%eax
jge    12ee <main+0x1ae>
movslq -0xc(%rbp),%rax
movsbl -0x4e50(%rbp,%rax,1),%eax
ff
sub    $0x61,%eax
mov    %eax,-0x4ec8(%rbp)
movslq -0x4ec8(%rbp),%rax
cmpl   $0x0,-0x4ec0(%rbp,%rax,4)
jle    12d2 <main+0x192>
movslq -0x4ec8(%rbp),%rax
mov    -0x4ec0(%rbp,%rax,4),%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4ec0(%rbp,%rax,4)
jmp    12db <main+0x19b>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    12e0 <main+0x1a0>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1266 <main+0x126>
movl   $0x0,-0xc(%rbp)
cmpl   $0x1a,-0xc(%rbp)
jge    131e <main+0x1de>
mov    -0x10(%rbp),%eax
movslq -0xc(%rbp),%rcx
add    -0x4ec0(%rbp,%rcx,4),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    12f5 <main+0x1b5>
mov    -0x10(%rbp),%esi
lea    0xcde(%rip),%rdi
call   1040 <printf@plt>
jmp    116b <main+0x2b>
mov    -0x4(%rbp),%eax
add    $0x4ed0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x4eb8,%rsp
movl   $0x0,0xc(%rsp)
lea    0xeb0(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
subl   $0x1,0xc(%rsp)
jae    1177 <main+0x47>
xor    %eax,%eax
add    $0x4eb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe85(%rip),%r14
lea    0x27a0(%rsp),%r15
lea    0x80(%rsp),%r13
lea    0xe71(%rip),%r12
jmp    1221 <main+0xf1>
nopw   0x0(%rax,%rax,1)
xor    %ebp,%ebp
movdqu 0x58(%rsp),%xmm0
movdqu 0x68(%rsp),%xmm1
movdqu 0x18(%rsp),%xmm2
movdqu 0x28(%rsp),%xmm3
paddd  %xmm2,%xmm3
movdqu 0x38(%rsp),%xmm2
paddd  %xmm0,%xmm2
movdqu 0x48(%rsp),%xmm0
paddd  %xmm1,%xmm0
paddd  %xmm2,%xmm0
pshufd $0xee,%xmm0,%xmm1
paddd  %xmm0,%xmm1
pshufd $0x55,%xmm1,%xmm0
paddd  %xmm1,%xmm0
movd   %xmm0,%eax
pshufd $0xee,%xmm3,%xmm0
paddd  %xmm3,%xmm0
pshufd $0x55,%xmm0,%xmm1
paddd  %xmm0,%xmm1
movd   %xmm1,%esi
add    %eax,%esi
add    0x14(%rsp),%esi
add    0x10(%rsp),%esi
add    %ebp,%esi
mov    %r12,%rdi
call   1040 <printf@plt>
subl   $0x1,0xc(%rsp)
jb     1163 <main+0x33>
pxor   %xmm0,%xmm0
movdqa %xmm0,0x60(%rsp)
movdqa %xmm0,0x50(%rsp)
movdqa %xmm0,0x40(%rsp)
movdqa %xmm0,0x30(%rsp)
movdqa %xmm0,0x20(%rsp)
movdqa %xmm0,0x10(%rsp)
movq   $0x0,0x70(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
pxor   %xmm0,%xmm0
movdqa %xmm0,0x10(%rsp)
movdqa %xmm0,0x20(%rsp)
movdqa %xmm0,0x30(%rsp)
movdqa %xmm0,0x40(%rsp)
movdqa %xmm0,0x50(%rsp)
movdqa %xmm0,0x60(%rsp)
movq   $0x0,0x70(%rsp)
mov    %r15,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    12d4 <main+0x1a4>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
movsbq 0x27a0(%rsp,%rbx,1),%rax
addl   $0x1,-0x174(%rsp,%rax,4)
01
add    $0x1,%rbx
mov    %r15,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jl     12b0 <main+0x180>
mov    %r13,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    11a0 <main+0x70>
xor    %ebx,%ebx
xor    %ebp,%ebp
jmp    130a <main+0x1da>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebp
add    $0x1,%rbx
mov    %r13,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbx
jge    11a2 <main+0x72>
movsbq 0x80(%rsp,%rbx,1),%rax
mov    -0x174(%rsp,%rax,4),%ecx
test   %ecx,%ecx
jle    12f0 <main+0x1c0>
add    $0xffffffff,%ecx
mov    %ecx,-0x174(%rsp,%rax,4)
jmp    12f3 <main+0x1c3>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10001 x i8]
%3 = alloca [10001 x i8]
%4 = alloca [26 x i32]
%5 = bitcast [26 x i32]* %4 to i8*
%6 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = add nsw i32 %8, -1
store i32 %9, i32* %1
%10 = icmp eq i32 %8, 0
br i1 %10, label %77, label %11
11: ; preds = %0
%12 = getelementptr inbounds [10001 x i8], [10001 x i8]* %2, i64 0, i64 0
%13 = getelementptr inbounds [10001 x i8], [10001 x i8]* %3, i64 0, i64 0
%14 = getelementptr inbounds [26 x i32], [26 x i32]* %4, i64 0, i64 0
%15 = getelementptr inbounds [26 x i32], [26 x i32]* %4, i64 0, i64 1
%16 = getelementptr inbounds [26 x i32], [26 x i32]* %4, i64 0, i64 2
%17 = getelementptr inbounds [26 x i32], [26 x i32]* %4, i64 0, i64 10
%18 = bitcast i32* %16 to <8 x i32>*
%19 = bitcast i32* %17 to <16 x i32>*
br label %20
20: ; preds = %11, %41
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %12)
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%23 = call i32 @strlen(i8* %12)
%24 = icmp sgt i32 %23, 0
br i1 %24, label %28, label %25
25: ; preds = %28, %20
%26 = call i32 @strlen(i8* %13)
%27 = icmp sgt i32 %26, 0
br i1 %27, label %57, label %41
28: ; preds = %20, %28
%29 = phi i64 [ %37, %28 ], [ 0, %20 ]
%30 = getelementptr inbounds [10001 x i8], [10001 x i8]* %2, i64 0, i64 %29
%31 = load i8, i8* %30
%32 = sext i8 %31 to i64
%33 = add nsw i64 %32, -97
%34 = getelementptr inbounds [26 x i32], [26 x i32]* %4, i64 0, i64 %33
%35 = load i32, i32* %34
%36 = add nsw i32 %35, 1
store i32 %36, i32* %34
%37 = add nuw nsw i64 %29, 1
%38 = call i32 @strlen(i8* %12)
%39 = sext i32 %38 to i64
%40 = icmp slt i64 %37, %39
br i1 %40, label %28, label %25
41: ; preds = %71, %25
%42 = phi i32 [ 0, %25 ], [ %72, %71 ]
%43 = load i32, i32* %14
%44 = load i32, i32* %15
%45 = load <8 x i32>, <8 x i32>* %18
%46 = load <16 x i32>, <16 x i32>* %19
%47 = call i32 @llvm.vector.reduce.add.v16i32(<16 x i32> %46)
%48 = call i32 @llvm.vector.reduce.add.v8i32(<8 x i32> %45)
%49 = add nsw i32 %47, %48
%50 = add nsw i32 %49, %44
%51 = add nsw i32 %50, %43
%52 = add nsw i32 %51, %42
%53 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %52)
%54 = load i32, i32* %1
%55 = add nsw i32 %54, -1
store i32 %55, i32* %1
%56 = icmp eq i32 %54, 0
br i1 %56, label %77, label %20
57: ; preds = %25, %71
%58 = phi i64 [ %73, %71 ], [ 0, %25 ]
%59 = phi i32 [ %72, %71 ], [ 0, %25 ]
%60 = getelementptr inbounds [10001 x i8], [10001 x i8]* %3, i64 0, i64 %58
%61 = load i8, i8* %60
%62 = sext i8 %61 to i64
%63 = add nsw i64 %62, -97
%64 = getelementptr inbounds [26 x i32], [26 x i32]* %4, i64 0, i64 %63
%65 = load i32, i32* %64
%66 = icmp sgt i32 %65, 0
br i1 %66, label %67, label %69
67: ; preds = %57
%68 = add nsw i32 %65, -1
store i32 %68, i32* %64
br label %71
69: ; preds = %57
%70 = add nsw i32 %59, 1
br label %71
71: ; preds = %69, %67
%72 = phi i32 [ %59, %67 ], [ %70, %69 ]
%73 = add nuw nsw i64 %58, 1
%74 = call i32 @strlen(i8* %13)
%75 = sext i32 %74 to i64
%76 = icmp slt i64 %73, %75
br i1 %76, label %57, label %41
77: ; preds = %41, %0
ret i32 0
}