program main
	implicit none
	integer       :: i, counter_C = 0, counter_Big = 0
	character(10) :: S
	read(*, *) S
	if(S(1:1) /= "A") then
		write(*, *) "WA"
	else
		do i = 3, len_trim(S)-1
			if(S(i:i) == "C") then
				counter_C = counter_C + 1
			end if
		end do
		do i = 1, len_trim(S)
			if(S(i:i) >= "A" .AND. S(i:i) <= "Z") then
				counter_Big = counter_Big + 1
			end if
		end do
		if(counter_C == 1 .AND. counter_Big == 2) then
			write(*, *) "AC"
		else
			write(*, *) "WA"
		end if
	end if
end program main
; ModuleID = 'FIRModule'
source_filename = "FIRModule"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-linux-gnu"

@_QFEcounter_big = internal unnamed_addr global i32 0
@_QFEcounter_c = internal unnamed_addr global i32 0
@_QQcl.d404f06cfffaac8c808a89a1f96d85a0 = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_5699/source.f\00"
@_QQcl.41 = linkonce constant [1 x i8] c"A"
@_QQcl.5741 = linkonce constant [2 x i8] c"WA"
@_QQcl.43 = linkonce constant [1 x i8] c"C"
@_QQcl.5A = linkonce constant [1 x i8] c"Z"
@_QQcl.4143 = linkonce constant [2 x i8] c"AC"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

define void @_QQmain() local_unnamed_addr {
  %1 = alloca [10 x i8], align 1
  %2 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.d404f06cfffaac8c808a89a1f96d85a0, i32 5)
  %3 = call i1 @_FortranAioInputAscii(ptr %2, ptr nonnull %1, i64 10)
  %4 = call i32 @_FortranAioEndIoStatement(ptr %2)
  %5 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %1, ptr nonnull @_QQcl.41, i64 1, i64 1)
  %.not = icmp eq i32 %5, 0
  br i1 %.not, label %.preheader11, label %6

6:                                                ; preds = %0
  %7 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.d404f06cfffaac8c808a89a1f96d85a0, i32 7)
  %8 = call i1 @_FortranAioOutputAscii(ptr %7, ptr nonnull @_QQcl.5741, i64 2)
  br label %64

.preheader11:                                     ; preds = %0, %.preheader11
  %9 = phi i64 [ %13, %.preheader11 ], [ 9, %0 ]
  %10 = getelementptr [10 x [1 x i8]], ptr %1, i64 0, i64 %9
  %11 = load i8, ptr %10, align 1, !tbaa !3
  %12 = icmp eq i8 %11, 32
  %13 = add nsw i64 %9, -1
  %14 = icmp ne i64 %9, 0
  %15 = and i1 %12, %14
  br i1 %15, label %.preheader11, label %16

16:                                               ; preds = %.preheader11
  %sext = shl i64 %9, 32
  %17 = icmp slt i64 %sext, 8589934593
  %.not24 = select i1 %12, i1 true, i1 %17
  br i1 %.not24, label %.preheader.preheader, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %16
  %18 = ashr exact i64 %sext, 32
  %.op = add nsw i64 %18, -2
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %select.unfold
  %19 = phi i64 [ %30, %select.unfold ], [ %.op, %.lr.ph.preheader ]
  %20 = phi i32 [ %29, %select.unfold ], [ 3, %.lr.ph.preheader ]
  %21 = sext i32 %20 to i64
  %22 = add nsw i64 %21, -1
  %23 = getelementptr [10 x [1 x i8]], ptr %1, i64 0, i64 %22
  %24 = call i32 @_FortranACharacterCompareScalar1(ptr %23, ptr nonnull @_QQcl.43, i64 1, i64 1)
  %25 = icmp eq i32 %24, 0
  br i1 %25, label %26, label %select.unfold

26:                                               ; preds = %.lr.ph
  %27 = load i32, ptr @_QFEcounter_c, align 4, !tbaa !3
  %28 = add i32 %27, 1
  store i32 %28, ptr @_QFEcounter_c, align 4, !tbaa !3
  br label %select.unfold

select.unfold:                                    ; preds = %26, %.lr.ph
  %29 = add i32 %20, 1
  %30 = add nsw i64 %19, -1
  %31 = icmp sgt i64 %19, 1
  br i1 %31, label %.lr.ph, label %.preheader.preheader

.preheader.preheader:                             ; preds = %select.unfold, %16
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %.preheader
  %32 = phi i64 [ %36, %.preheader ], [ 9, %.preheader.preheader ]
  %33 = getelementptr [10 x [1 x i8]], ptr %1, i64 0, i64 %32
  %34 = load i8, ptr %33, align 1, !tbaa !3
  %35 = icmp eq i8 %34, 32
  %36 = add nsw i64 %32, -1
  %37 = icmp ne i64 %32, 0
  %38 = and i1 %35, %37
  br i1 %38, label %.preheader, label %39

39:                                               ; preds = %.preheader
  %40 = shl i64 %32, 32
  %sext8 = add i64 %40, 4294967296
  %41 = ashr exact i64 %sext8, 32
  %spec.select10 = select i1 %35, i64 0, i64 %41
  %42 = icmp sgt i64 %spec.select10, 0
  br i1 %42, label %.lr.ph15, label %select.unfold9._crit_edge

.lr.ph15:                                         ; preds = %39, %select.unfold9
  %indvars.iv = phi i64 [ %indvars.iv.next, %select.unfold9 ], [ 1, %39 ]
  %43 = add nsw i64 %indvars.iv, -1
  %44 = getelementptr [10 x [1 x i8]], ptr %1, i64 0, i64 %43
  %45 = call i32 @_FortranACharacterCompareScalar1(ptr %44, ptr nonnull @_QQcl.41, i64 1, i64 1)
  %46 = icmp sgt i32 %45, -1
  %47 = call i32 @_FortranACharacterCompareScalar1(ptr %44, ptr nonnull @_QQcl.5A, i64 1, i64 1)
  %48 = icmp slt i32 %47, 1
  %49 = and i1 %46, %48
  br i1 %49, label %50, label %select.unfold9

50:                                               ; preds = %.lr.ph15
  %51 = load i32, ptr @_QFEcounter_big, align 4, !tbaa !3
  %52 = add i32 %51, 1
  store i32 %52, ptr @_QFEcounter_big, align 4, !tbaa !3
  br label %select.unfold9

select.unfold9:                                   ; preds = %50, %.lr.ph15
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv, %spec.select10
  br i1 %exitcond.not, label %select.unfold9._crit_edge, label %.lr.ph15

select.unfold9._crit_edge:                        ; preds = %select.unfold9, %39
  %53 = load i32, ptr @_QFEcounter_c, align 4, !tbaa !3
  %54 = icmp eq i32 %53, 1
  %55 = load i32, ptr @_QFEcounter_big, align 4, !tbaa !3
  %56 = icmp eq i32 %55, 2
  %57 = and i1 %54, %56
  br i1 %57, label %58, label %61

58:                                               ; preds = %select.unfold9._crit_edge
  %59 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.d404f06cfffaac8c808a89a1f96d85a0, i32 20)
  %60 = call i1 @_FortranAioOutputAscii(ptr %59, ptr nonnull @_QQcl.4143, i64 2)
  br label %64

61:                                               ; preds = %select.unfold9._crit_edge
  %62 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.d404f06cfffaac8c808a89a1f96d85a0, i32 22)
  %63 = call i1 @_FortranAioOutputAscii(ptr %62, ptr nonnull @_QQcl.5741, i64 2)
  br label %64

64:                                               ; preds = %6, %58, %61
  %.sink = phi ptr [ %7, %6 ], [ %59, %58 ], [ %62, %61 ]
  %65 = call i32 @_FortranAioEndIoStatement(ptr %.sink)
  ret void
}

declare ptr @_FortranAioBeginExternalListInput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioInputAscii(ptr, ptr, i64) local_unnamed_addr

declare i32 @_FortranAioEndIoStatement(ptr) local_unnamed_addr

declare i32 @_FortranACharacterCompareScalar1(ptr, ptr, i64, i64) local_unnamed_addr

declare ptr @_FortranAioBeginExternalListOutput(i32, ptr, i32) local_unnamed_addr

declare i1 @_FortranAioOutputAscii(ptr, ptr, i64) local_unnamed_addr

!llvm.module.flags = !{!0, !1, !2}

!0 = !{i32 2, !"Debug Info Version", i32 3}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{!4, !4, i64 0}
!4 = !{!"any data access", !5, i64 0}
!5 = !{!"any access", !6, i64 0}
!6 = !{!"Flang Type TBAA Root"}
