// File: kage08[P]RegexLibrary/REGEX2NFA.cpp
// Function: main
int main(){
  set<char> alphabet;
  string line;
  getline(cin,line);
  for(char c:line){
    if(!(c==' ' || c=='\n')) alphabet.insert(c);
  }
  cin>>line;
  string ln;
  for(char c:line) if(c!=' ') ln.append(string(1,c));
  line=ln;
  //cout<<line<<endl;
  line=addConcat(line,alphabet);
  //cout<<line<<endl;
  line=toPostFix(line,alphabet);
  //cout<<line<<endl;
  NFA C=makeNFA(line,alphabet);
  printNFA(C);
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x250, %rsp            # imm = 0x250
movl $0x0, -0x4(%rbp)
leaq -0x38(%rbp), %rdi
callq 0xf4d0
leaq -0x58(%rbp), %rdi
movq %rdi, -0x210(%rbp)
callq 0x22f0
movq -0x210(%rbp), %rsi
movq 0xaecf(%rip), %rdi      # 0x19fd8
callq 0x2060
jmp 0xf110
leaq -0x58(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rdi
callq 0x21a0
movq %rax, -0x78(%rbp)
movq -0x70(%rbp), %rdi
callq 0x2110
movq %rax, -0x80(%rbp)
leaq -0x78(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x6030
testb $0x1, %al
jne 0xf148
jmp 0xf1cd
leaq -0x78(%rbp), %rdi
callq 0x6070
movb (%rax), %al
movb %al, -0x81(%rbp)
movsbl -0x81(%rbp), %eax
cmpl $0x20, %eax
je 0xf1bd
movsbl -0x81(%rbp), %eax
cmpl $0xa, %eax
je 0xf1bd
leaq -0x38(%rbp), %rdi
leaq -0x81(%rbp), %rsi
callq 0xf4f0
movb %dl, -0x219(%rbp)
movq %rax, -0x218(%rbp)
jmp 0xf190
movb -0x219(%rbp), %al
movq -0x218(%rbp), %rcx
movq %rcx, -0x98(%rbp)
movb %al, -0x90(%rbp)
jmp 0xf1bd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xf4ac
jmp 0xf1bf
leaq -0x78(%rbp), %rdi
callq 0x6170
jmp 0xf132
movq 0xae04(%rip), %rdi      # 0x19fd8
leaq -0x58(%rbp), %rsi
callq 0x22d0
jmp 0xf1df
leaq -0xb8(%rbp), %rdi
callq 0x22f0
leaq -0x58(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0xc0(%rbp), %rdi
callq 0x21a0
movq %rax, -0xc8(%rbp)
movq -0xc0(%rbp), %rdi
callq 0x2110
movq %rax, -0xd0(%rbp)
leaq -0xc8(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x6030
testb $0x1, %al
jne 0xf238
jmp 0xf315
leaq -0xc8(%rbp), %rdi
callq 0x6070
movb (%rax), %al
movb %al, -0xd1(%rbp)
movsbl -0xd1(%rbp), %eax
cmpl $0x20, %eax
je 0xf302
movsbl -0xd1(%rbp), %eax
movl %eax, -0x22c(%rbp)
leaq -0xf9(%rbp), %rdi
movq %rdi, -0x228(%rbp)
callq 0x2390
movl -0x22c(%rbp), %edx
movq -0x228(%rbp), %rcx
leaq -0xf8(%rbp), %rdi
movl $0x1, %esi
callq 0x6340
jmp 0xf29c
leaq -0xb8(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x23c0
jmp 0xf2b1
leaq -0xf8(%rbp), %rdi
callq 0x2140
leaq -0xf9(%rbp), %rdi
callq 0x2230
jmp 0xf302
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xf2f1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x2140
leaq -0xf9(%rbp), %rdi
callq 0x2230
jmp 0xf4a0
jmp 0xf304
leaq -0xc8(%rbp), %rdi
callq 0x6170
jmp 0xf21c
leaq -0x58(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x2030
jmp 0xf327
leaq -0x150(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0xf540
jmp 0xf339
leaq -0x120(%rbp), %rdi
leaq -0x58(%rbp), %rsi
leaq -0x150(%rbp), %rdx
callq 0x40e0
jmp 0xf352
leaq -0x58(%rbp), %rdi
leaq -0x120(%rbp), %rsi
movq %rsi, -0x238(%rbp)
callq 0x22a0
movq -0x238(%rbp), %rdi
callq 0x2140
leaq -0x150(%rbp), %rdi
callq 0xf570
leaq -0x1a0(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0xf540
jmp 0xf393
leaq -0x170(%rbp), %rdi
leaq -0x58(%rbp), %rsi
leaq -0x1a0(%rbp), %rdx
callq 0x4420
jmp 0xf3ac
leaq -0x58(%rbp), %rdi
movq %rdi, -0x240(%rbp)
leaq -0x170(%rbp), %rsi
movq %rsi, -0x248(%rbp)
callq 0x22a0
movq -0x248(%rbp), %rdi
callq 0x2140
leaq -0x1a0(%rbp), %rdi
callq 0xf570
movq -0x240(%rbp), %rsi
leaq -0x208(%rbp), %rdi
leaq -0x38(%rbp), %rdx
callq 0x36e0
jmp 0xf3fb
leaq -0x208(%rbp), %rdi
callq 0x3c30
jmp 0xf409
movl $0x0, -0x4(%rbp)
leaq -0x208(%rbp), %rdi
callq 0x5aa0
leaq -0xb8(%rbp), %rdi
callq 0x2140
leaq -0x58(%rbp), %rdi
callq 0x2140
leaq -0x38(%rbp), %rdi
callq 0xf570
movl -0x4(%rbp), %eax
addq $0x250, %rsp            # imm = 0x250
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
jmp 0xf4a0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x150(%rbp), %rdi
callq 0xf570
jmp 0xf4a0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0xf570
jmp 0xf4a0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x208(%rbp), %rdi
callq 0x5aa0
leaq -0xb8(%rbp), %rdi
callq 0x2140
leaq -0x58(%rbp), %rdi
callq 0x2140
leaq -0x38(%rbp), %rdi
callq 0xf570
movq -0x60(%rbp), %rdi
callq 0x2380
nopw (%rax,%rax)