program main
 implicit none
   character*3::word

   read*,word

   if(word(1:1)=='S' .and. word(2:2)=='S' .and. word(3:3)=='S') print*,0
   if(word(1:1)=='R' .and. word(2:2)=='S' .and. word(3:3)=='S') print*,1
   if(word(1:1)=='S' .and. word(2:2)=='R' .and. word(3:3)=='S') print*,1
   if(word(1:1)=='S' .and. word(2:2)=='S' .and. word(3:3)=='R') print*,1
   if(word(1:1)=='R' .and. word(2:2)=='S' .and. word(3:3)=='R') print*,1
   if(word(1:1)=='R' .and. word(2:2)=='R' .and. word(3:3)=='S') print*,2
   if(word(1:1)=='S' .and. word(2:2)=='R' .and. word(3:3)=='R') print*,2
   if(word(1:1)=='R' .and. word(2:2)=='R' .and. word(3:3)=='R') print*,3

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"

@_QQcl.f2a7957c7655e444d1b57876941fcb80 = linkonce constant [72 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_794/source.f\00"
@_QQcl.53 = linkonce constant [1 x i8] c"S"
@_QQcl.52 = linkonce constant [1 x i8] c"R"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

define void @_QQmain() local_unnamed_addr {
  %1 = alloca [3 x i8], align 1
  %2 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.f2a7957c7655e444d1b57876941fcb80, i32 5)
  %3 = call i1 @_FortranAioInputAscii(ptr %2, ptr nonnull %1, i64 3)
  %4 = call i32 @_FortranAioEndIoStatement(ptr %2)
  %5 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %1, ptr nonnull @_QQcl.53, i64 1, i64 1)
  %6 = getelementptr inbounds [3 x [1 x i8]], ptr %1, i64 0, i64 1
  %7 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %6, ptr nonnull @_QQcl.53, i64 1, i64 1)
  %8 = or i32 %7, %5
  %9 = getelementptr inbounds [3 x [1 x i8]], ptr %1, i64 0, i64 2
  %10 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %9, ptr nonnull @_QQcl.53, i64 1, i64 1)
  %11 = or i32 %8, %10
  %12 = icmp eq i32 %11, 0
  br i1 %12, label %13, label %17

13:                                               ; preds = %0
  %14 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.f2a7957c7655e444d1b57876941fcb80, i32 7)
  %15 = call i1 @_FortranAioOutputInteger32(ptr %14, i32 0)
  %16 = call i32 @_FortranAioEndIoStatement(ptr %14)
  br label %17

17:                                               ; preds = %13, %0
  %18 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %1, ptr nonnull @_QQcl.52, i64 1, i64 1)
  %19 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %6, ptr nonnull @_QQcl.53, i64 1, i64 1)
  %20 = or i32 %19, %18
  %21 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %9, ptr nonnull @_QQcl.53, i64 1, i64 1)
  %22 = or i32 %20, %21
  %23 = icmp eq i32 %22, 0
  br i1 %23, label %24, label %28

24:                                               ; preds = %17
  %25 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.f2a7957c7655e444d1b57876941fcb80, i32 8)
  %26 = call i1 @_FortranAioOutputInteger32(ptr %25, i32 1)
  %27 = call i32 @_FortranAioEndIoStatement(ptr %25)
  br label %28

28:                                               ; preds = %24, %17
  %29 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %1, ptr nonnull @_QQcl.53, i64 1, i64 1)
  %30 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %6, ptr nonnull @_QQcl.52, i64 1, i64 1)
  %31 = or i32 %30, %29
  %32 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %9, ptr nonnull @_QQcl.53, i64 1, i64 1)
  %33 = or i32 %31, %32
  %34 = icmp eq i32 %33, 0
  br i1 %34, label %35, label %39

35:                                               ; preds = %28
  %36 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.f2a7957c7655e444d1b57876941fcb80, i32 9)
  %37 = call i1 @_FortranAioOutputInteger32(ptr %36, i32 1)
  %38 = call i32 @_FortranAioEndIoStatement(ptr %36)
  br label %39

39:                                               ; preds = %35, %28
  %40 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %1, ptr nonnull @_QQcl.53, i64 1, i64 1)
  %41 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %6, ptr nonnull @_QQcl.53, i64 1, i64 1)
  %42 = or i32 %41, %40
  %43 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %9, ptr nonnull @_QQcl.52, i64 1, i64 1)
  %44 = or i32 %42, %43
  %45 = icmp eq i32 %44, 0
  br i1 %45, label %46, label %50

46:                                               ; preds = %39
  %47 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.f2a7957c7655e444d1b57876941fcb80, i32 10)
  %48 = call i1 @_FortranAioOutputInteger32(ptr %47, i32 1)
  %49 = call i32 @_FortranAioEndIoStatement(ptr %47)
  br label %50

50:                                               ; preds = %46, %39
  %51 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %1, ptr nonnull @_QQcl.52, i64 1, i64 1)
  %52 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %6, ptr nonnull @_QQcl.53, i64 1, i64 1)
  %53 = or i32 %52, %51
  %54 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %9, ptr nonnull @_QQcl.52, i64 1, i64 1)
  %55 = or i32 %53, %54
  %56 = icmp eq i32 %55, 0
  br i1 %56, label %57, label %61

57:                                               ; preds = %50
  %58 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.f2a7957c7655e444d1b57876941fcb80, i32 11)
  %59 = call i1 @_FortranAioOutputInteger32(ptr %58, i32 1)
  %60 = call i32 @_FortranAioEndIoStatement(ptr %58)
  br label %61

61:                                               ; preds = %57, %50
  %62 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %1, ptr nonnull @_QQcl.52, i64 1, i64 1)
  %63 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %6, ptr nonnull @_QQcl.52, i64 1, i64 1)
  %64 = or i32 %63, %62
  %65 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %9, ptr nonnull @_QQcl.53, i64 1, i64 1)
  %66 = or i32 %64, %65
  %67 = icmp eq i32 %66, 0
  br i1 %67, label %68, label %72

68:                                               ; preds = %61
  %69 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.f2a7957c7655e444d1b57876941fcb80, i32 12)
  %70 = call i1 @_FortranAioOutputInteger32(ptr %69, i32 2)
  %71 = call i32 @_FortranAioEndIoStatement(ptr %69)
  br label %72

72:                                               ; preds = %68, %61
  %73 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %1, ptr nonnull @_QQcl.53, i64 1, i64 1)
  %74 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %6, ptr nonnull @_QQcl.52, i64 1, i64 1)
  %75 = or i32 %74, %73
  %76 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %9, ptr nonnull @_QQcl.52, i64 1, i64 1)
  %77 = or i32 %75, %76
  %78 = icmp eq i32 %77, 0
  br i1 %78, label %79, label %83

79:                                               ; preds = %72
  %80 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.f2a7957c7655e444d1b57876941fcb80, i32 13)
  %81 = call i1 @_FortranAioOutputInteger32(ptr %80, i32 2)
  %82 = call i32 @_FortranAioEndIoStatement(ptr %80)
  br label %83

83:                                               ; preds = %79, %72
  %84 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %1, ptr nonnull @_QQcl.52, i64 1, i64 1)
  %85 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %6, ptr nonnull @_QQcl.52, i64 1, i64 1)
  %86 = or i32 %85, %84
  %87 = call i32 @_FortranACharacterCompareScalar1(ptr nonnull %9, ptr nonnull @_QQcl.52, i64 1, i64 1)
  %88 = or i32 %86, %87
  %89 = icmp eq i32 %88, 0
  br i1 %89, label %90, label %94

90:                                               ; preds = %83
  %91 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.f2a7957c7655e444d1b57876941fcb80, i32 14)
  %92 = call i1 @_FortranAioOutputInteger32(ptr %91, i32 3)
  %93 = call i32 @_FortranAioEndIoStatement(ptr %91)
  br label %94

94:                                               ; preds = %90, %83
  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 @_FortranAioOutputInteger32(ptr, i32) 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}
