program prob3
    implicit none
    character(100005) :: s
    integer :: a, b, i, N
    read(*,*) s
    N = len_trim(s)
    a = 0
    b = 0
    do i = 1, N
        if(s(i:i) == '1')then
            a = a + 1
        else
            b = b + 1
        end if
    end do

    write(*,*) 2*min(a, b)
    stop
contains
end program prob3
; 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"

@_QFEs = internal global [100005 x i8] undef
@_QQcl.5272c6f95d6b2102d811d72b1c3423cf = linkonce constant [73 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_4833/source.f\00"
@_QQcl.31 = linkonce constant [1 x i8] c"1"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

; Function Attrs: noreturn
define void @_QQmain() local_unnamed_addr #0 {
  %1 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.5272c6f95d6b2102d811d72b1c3423cf, i32 5)
  %2 = tail call i1 @_FortranAioInputAscii(ptr %1, ptr nonnull @_QFEs, i64 100005)
  %3 = tail call i32 @_FortranAioEndIoStatement(ptr %1)
  br label %4

4:                                                ; preds = %0, %4
  %5 = phi i64 [ 100004, %0 ], [ %9, %4 ]
  %6 = getelementptr [100005 x [1 x i8]], ptr @_QFEs, i64 0, i64 %5
  %7 = load i8, ptr %6, align 1, !tbaa !3
  %8 = icmp eq i8 %7, 32
  %9 = add nsw i64 %5, -1
  %10 = icmp ne i64 %5, 0
  %11 = and i1 %8, %10
  br i1 %11, label %4, label %12

12:                                               ; preds = %4
  %13 = shl i64 %5, 32
  %sext = add i64 %13, 4294967296
  %14 = ashr exact i64 %sext, 32
  %spec.select = select i1 %8, i64 0, i64 %14
  %15 = icmp sgt i64 %spec.select, 0
  br i1 %15, label %select.unfold, label %select.unfold._crit_edge

select.unfold:                                    ; preds = %12, %select.unfold
  %indvars.iv = phi i64 [ %indvars.iv.next, %select.unfold ], [ 1, %12 ]
  %.013 = phi i32 [ %.1, %select.unfold ], [ 0, %12 ]
  %.0712 = phi i32 [ %.18, %select.unfold ], [ 0, %12 ]
  %16 = add nsw i64 %indvars.iv, -1
  %17 = getelementptr [100005 x [1 x i8]], ptr @_QFEs, i64 0, i64 %16
  %18 = tail call i32 @_FortranACharacterCompareScalar1(ptr %17, ptr nonnull @_QQcl.31, i64 1, i64 1)
  %19 = icmp ne i32 %18, 0
  %20 = zext i1 %19 to i32
  %.18 = add i32 %.0712, %20
  %not. = xor i1 %19, true
  %21 = zext i1 %not. to i32
  %.1 = add i32 %.013, %21
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv, %spec.select
  br i1 %exitcond.not, label %select.unfold._crit_edge, label %select.unfold

select.unfold._crit_edge:                         ; preds = %select.unfold, %12
  %.07.lcssa = phi i32 [ 0, %12 ], [ %.18, %select.unfold ]
  %.0.lcssa = phi i32 [ 0, %12 ], [ %.1, %select.unfold ]
  %22 = tail call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.5272c6f95d6b2102d811d72b1c3423cf, i32 17)
  %23 = tail call i32 @llvm.smin.i32(i32 %.0.lcssa, i32 %.07.lcssa)
  %24 = shl i32 %23, 1
  %25 = tail call i1 @_FortranAioOutputInteger32(ptr %22, i32 %24)
  %26 = tail call i32 @_FortranAioEndIoStatement(ptr %22)
  %27 = tail call {} @_FortranAStopStatement(i32 0, i1 false, i1 false)
  unreachable
}

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

declare {} @_FortranAStopStatement(i32, i1, i1) local_unnamed_addr

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smin.i32(i32, i32) #1

attributes #0 = { noreturn }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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"}
