#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 *);
scalar_t__ s(char);
int /*<<< orphan*/ scanf(char *, char *);
int strlen(char *);
int main() {
  int i, z, t, x, y;
  char a[14], b[14] = "23456789TJQKA";
  scanf("%s", a);
  for (i = 0; i < strlen(a) - 1; i++) {
    t = 0;
    for (z = 0; z < strlen(b); z++) {
      if (a[i] == b[z]) {
        t = 1;
      }
    }
  }
  for (x = 0; x < strlen(a); x++) {
    for (y = 0; y < strlen(a) - 1; y++) {
      if (s(a[y]) > s(a[y + 1])) {
        int temp = a[y + 1];
        a[y + 1] = a[y];
        a[y] = temp;
      }
    }
  }
  printf("%s", a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeaa(%rip),%rax
mov    %rax,-0x34(%rbp)
mov    0xea8(%rip),%eax
mov    %eax,-0x2c(%rbp)
mov    0xea2(%rip),%ax
mov    %ax,-0x28(%rbp)
lea    -0x26(%rbp),%rsi
lea    0xe95(%rip),%rdi
call   1060 <scanf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x3c(%rbp)
lea    -0x26(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x3c(%rbp),%eax
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1215 <main+0xd5>
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x40(%rbp)
lea    -0x34(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x40(%rbp),%eax
cmp    %ecx,%eax
jge    1202 <main+0xc2>
movslq -0x8(%rbp),%rax
movsbl -0x26(%rbp,%rax,1),%eax
movslq -0xc(%rbp),%rcx
movsbl -0x34(%rbp,%rcx,1),%ecx
cmp    %ecx,%eax
jne    11ef <main+0xaf>
movl   $0x1,-0x10(%rbp)
jmp    11f4 <main+0xb4>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11b2 <main+0x72>
jmp    1207 <main+0xc7>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1185 <main+0x45>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x44(%rbp)
lea    -0x26(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x44(%rbp),%eax
cmp    %ecx,%eax
jge    12e9 <main+0x1a9>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x48(%rbp)
lea    -0x26(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%eax
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    12d6 <main+0x196>
movslq -0x18(%rbp),%rax
movsbl -0x26(%rbp,%rax,1),%edi
call   1050 <s@plt>
mov    %rax,-0x50(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0x26(%rbp,%rax,1),%edi
call   1050 <s@plt>
mov    %rax,%rcx
mov    -0x50(%rbp),%rax
cmp    %rcx,%rax
jle    12c3 <main+0x183>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
cltq
movsbl -0x26(%rbp,%rax,1),%eax
mov    %eax,-0x38(%rbp)
movslq -0x18(%rbp),%rax
mov    -0x26(%rbp,%rax,1),%cl
mov    -0x18(%rbp),%eax
add    $0x1,%eax
cltq
mov    %cl,-0x26(%rbp,%rax,1)
mov    -0x38(%rbp),%eax
mov    %al,%cl
movslq -0x18(%rbp),%rax
mov    %cl,-0x26(%rbp,%rax,1)
jmp    12c8 <main+0x188>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    123f <main+0xff>
jmp    12db <main+0x19b>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    121c <main+0xdc>
lea    -0x26(%rbp),%rsi
lea    0xd1a(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
movabs $0x414b514a543938,%rax
mov    %rax,0x16(%rsp)
movabs $0x3938373635343332,%rax
37 38 39
mov    %rax,0x10(%rsp)
lea    0xe9d(%rip),%rdi
lea    0x2(%rsp),%rbx
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    $0x2,%eax
jl     11d3 <main+0x93>
xor    %r15d,%r15d
lea    0x10(%rsp),%rbx
lea    0x2(%rsp),%r14
nopl   0x0(%rax,%rax,1)
mov    $0xffffffff,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rbx,%rdi
call   1030 <strlen@plt>
add    $0x1,%ebp
cmp    %eax,%ebp
jl     11b0 <main+0x70>
add    $0x1,%r15d
mov    %r14,%rdi
call   1030 <strlen@plt>
add    $0xffffffff,%eax
cmp    %eax,%r15d
jl     11a0 <main+0x60>
lea    0x2(%rsp),%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    125d <main+0x11d>
xor    %r15d,%r15d
lea    0x2(%rsp),%r14
jmp    1201 <main+0xc1>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r15d
mov    %r14,%rdi
call   1030 <strlen@plt>
cmp    %eax,%r15d
jge    125d <main+0x11d>
mov    %r14,%rdi
call   1030 <strlen@plt>
cmp    $0x2,%eax
jl     11f0 <main+0xb0>
xor    %ebp,%ebp
jmp    1235 <main+0xf5>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
call   1030 <strlen@plt>
add    $0xffffffff,%eax
cltq
mov    %rbx,%rbp
cmp    %rax,%rbx
jge    11f0 <main+0xb0>
movsbl 0x2(%rsp,%rbp,1),%edi
call   1050 <s@plt>
mov    %rax,%r12
lea    0x1(%rbp),%rbx
movsbl 0x3(%rsp,%rbp,1),%edi
call   1050 <s@plt>
cmp    %rax,%r12
jle    1220 <main+0xe0>
rolw   $0x8,0x2(%rsp,%rbp,1)
jmp    1220 <main+0xe0>
lea    0xdaa(%rip),%rdi
lea    0x2(%rsp),%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@__const.main.b = [14 x i8] c"23456789TJQKA\00"
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [14 x i8]
%2 = alloca [14 x i8]
%3 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [14 x i8], [14 x i8]* %2, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%6 = call i32 @strlen(i8* %3)
%7 = icmp sgt i32 %6, 1
br i1 %7, label %8, label %10
8: ; preds = %0, %18
%9 = phi i32 [ %19, %18 ], [ 0, %0 ]
br label %13
10: ; preds = %18, %0
%11 = call i32 @strlen(i8* %3)
%12 = icmp sgt i32 %11, 0
br i1 %12, label %23, label %49
13: ; preds = %13, %8
%14 = phi i32 [ %17, %13 ], [ 0, %8 ]
%15 = call i32 @strlen(i8* %4)
%16 = icmp slt i32 %14, %15
%17 = add nuw nsw i32 %14, 1
br i1 %16, label %13, label %18
18: ; preds = %13
%19 = add nuw nsw i32 %9, 1
%20 = call i32 @strlen(i8* %3)
%21 = add nsw i32 %20, -1
%22 = icmp slt i32 %19, %21
br i1 %22, label %8, label %10
23: ; preds = %10, %45
%24 = phi i32 [ %46, %45 ], [ 0, %10 ]
%25 = call i32 @strlen(i8* %3)
%26 = icmp sgt i32 %25, 1
br i1 %26, label %27, label %45
27: ; preds = %23, %40
%28 = phi i64 [ %32, %40 ], [ 0, %23 ]
%29 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 %28
%30 = load i8, i8* %29
%31 = call i64 @s(i8 signext %30)
%32 = add nuw nsw i64 %28, 1
%33 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 %32
%34 = load i8, i8* %33
%35 = call i64 @s(i8 signext %34)
%36 = icmp sgt i64 %31, %35
br i1 %36, label %37, label %40
37: ; preds = %27
%38 = load i8, i8* %33
%39 = load i8, i8* %29
store i8 %39, i8* %33
store i8 %38, i8* %29
br label %40
40: ; preds = %27, %37
%41 = call i32 @strlen(i8* %3)
%42 = add nsw i32 %41, -1
%43 = sext i32 %42 to i64
%44 = icmp slt i64 %32, %43
br i1 %44, label %27, label %45
45: ; preds = %40, %23
%46 = add nuw nsw i32 %24, 1
%47 = call i32 @strlen(i8* %3)
%48 = icmp slt i32 %46, %47
br i1 %48, label %23, label %49
49: ; preds = %45, %10
%50 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
ret i32 0
}