program main
    implicit none
    character(1000)::s,t
    integer::n,m,ans,i,j,nm
    integer,allocatable::aaa(:)

    ans=0

    read*,s,t
    !print*,s,t

    n=len_trim(s)
    m=len_trim(t)
    nm=n-m
    !print*,n,m,nm
    allocate(aaa(nm+1))
    !print*,s(n:n),t(m:m)
    if(nm==0) then
        do i=1,m
            if(s(i:i)/=t(i:i)) then
                !print*,s(i:i)
                ans=ans+1
            end if
        end do
        go to 100
    end if

    
    ans=0
    if(nm>0) then
        !print*,s(1:1)
        do i=1,nm+1
            aaa(i)=0
            do j=i,m+i-1
               ! print*,s(j:j)
                if(s(j:j)/=t(j-i+1:j-i+1)) then
                   ! print*,s(j:j)
                    aaa(i)=aaa(i)+1
                end if
            end do
        end do
        ans=minval(aaa)
    end if

100 print*,ans
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"

@_QFEaaa.0 = internal unnamed_addr global ptr null
@_QFEaaa.8 = internal unnamed_addr global i64 0
@_QFEs = internal global [1000 x i8] undef
@_QFEt = internal global [1000 x i8] undef
@_QQcl.b35d0549634cdd21fe6214377dade6e3 = linkonce constant [72 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_702/source.f\00"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #0

define void @_QQmain() local_unnamed_addr {
  %1 = alloca { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, align 8
  %2 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.b35d0549634cdd21fe6214377dade6e3, i32 9)
  %3 = tail call i1 @_FortranAioInputAscii(ptr %2, ptr nonnull @_QFEs, i64 1000)
  %4 = tail call i1 @_FortranAioInputAscii(ptr %2, ptr nonnull @_QFEt, i64 1000)
  %5 = tail call i32 @_FortranAioEndIoStatement(ptr %2)
  br label %6

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

14:                                               ; preds = %6
  %15 = trunc i64 %7 to i32
  %16 = add i32 %15, 1
  br label %17

17:                                               ; preds = %14, %17
  %18 = phi i64 [ 999, %14 ], [ %22, %17 ]
  %19 = getelementptr [1000 x [1 x i8]], ptr @_QFEt, i64 0, i64 %18
  %20 = load i8, ptr %19, align 1, !tbaa !3
  %21 = icmp eq i8 %20, 32
  %22 = add nsw i64 %18, -1
  %23 = icmp ne i64 %18, 0
  %24 = and i1 %21, %23
  br i1 %24, label %17, label %25

25:                                               ; preds = %17
  %26 = select i1 %10, i32 0, i32 %16
  %27 = trunc i64 %18 to i32
  %28 = add i32 %27, 1
  %29 = select i1 %21, i32 0, i32 %28
  %30 = sub i32 %26, %29
  %31 = add i32 %30, 1
  %32 = sext i32 %31 to i64
  %33 = tail call i64 @llvm.smax.i64(i64 %32, i64 0)
  %34 = shl nuw nsw i64 %33, 2
  %35 = tail call ptr @malloc(i64 %34)
  store ptr %35, ptr @_QFEaaa.0, align 8, !tbaa !7
  store i64 %33, ptr @_QFEaaa.8, align 8, !tbaa !7
  %36 = icmp eq i32 %26, %29
  br i1 %36, label %37, label %45

37:                                               ; preds = %25
  %38 = icmp sgt i32 %26, 0
  br i1 %38, label %.lr.ph175.preheader, label %.loopexit

.lr.ph175.preheader:                              ; preds = %37
  %39 = zext i32 %26 to i64
  br label %.lr.ph175

.lr.ph175:                                        ; preds = %.lr.ph175.preheader, %.lr.ph175
  %indvars.iv181 = phi i64 [ 1, %.lr.ph175.preheader ], [ %indvars.iv.next182, %.lr.ph175 ]
  %.0173 = phi i32 [ 0, %.lr.ph175.preheader ], [ %spec.select, %.lr.ph175 ]
  %40 = add nsw i64 %indvars.iv181, -1
  %41 = getelementptr [1000 x [1 x i8]], ptr @_QFEs, i64 0, i64 %40
  %42 = getelementptr [1000 x [1 x i8]], ptr @_QFEt, i64 0, i64 %40
  %43 = tail call i32 @_FortranACharacterCompareScalar1(ptr %41, ptr %42, i64 1, i64 1)
  %.not166 = icmp ne i32 %43, 0
  %44 = zext i1 %.not166 to i32
  %spec.select = add i32 %.0173, %44
  %indvars.iv.next182 = add nuw nsw i64 %indvars.iv181, 1
  %exitcond.not = icmp eq i64 %indvars.iv181, %39
  br i1 %exitcond.not, label %.loopexit, label %.lr.ph175

45:                                               ; preds = %25
  %46 = icmp sgt i32 %30, 0
  br i1 %46, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %45
  %.not176 = icmp eq i32 %30, 2147483647
  br i1 %.not176, label %._crit_edge172, label %.lr.ph171

.lr.ph171:                                        ; preds = %.preheader
  %47 = add i32 %29, -1
  br label %48

48:                                               ; preds = %.lr.ph171, %._crit_edge
  %indvars.iv = phi i64 [ 1, %.lr.ph171 ], [ %indvars.iv.next, %._crit_edge ]
  %49 = phi i64 [ %32, %.lr.ph171 ], [ %79, %._crit_edge ]
  %.unpack142 = load ptr, ptr @_QFEaaa.0, align 8, !tbaa !7
  %50 = add nsw i64 %indvars.iv, -1
  %51 = getelementptr i32, ptr %.unpack142, i64 %50
  store i32 0, ptr %51, align 4, !tbaa !3
  %52 = trunc i64 %indvars.iv to i32
  %53 = add i32 %47, %52
  %54 = sext i32 %53 to i64
  %55 = sub nsw i64 1, %indvars.iv
  %56 = add nsw i64 %55, %54
  %57 = icmp sgt i64 %56, 0
  br i1 %57, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %48
  %58 = trunc i64 %55 to i32
  %59 = add nsw i64 %indvars.iv, -1
  br label %60

60:                                               ; preds = %.lr.ph, %75
  %61 = phi i64 [ %56, %.lr.ph ], [ %77, %75 ]
  %62 = phi i32 [ %52, %.lr.ph ], [ %76, %75 ]
  %63 = sext i32 %62 to i64
  %64 = add nsw i64 %63, -1
  %65 = getelementptr [1000 x [1 x i8]], ptr @_QFEs, i64 0, i64 %64
  %66 = add i32 %62, %58
  %67 = sext i32 %66 to i64
  %68 = add nsw i64 %67, -1
  %69 = getelementptr [1000 x [1 x i8]], ptr @_QFEt, i64 0, i64 %68
  %70 = tail call i32 @_FortranACharacterCompareScalar1(ptr %65, ptr %69, i64 1, i64 1)
  %.not = icmp eq i32 %70, 0
  br i1 %.not, label %75, label %71

71:                                               ; preds = %60
  %.unpack154 = load ptr, ptr @_QFEaaa.0, align 8, !tbaa !7
  %72 = getelementptr i32, ptr %.unpack154, i64 %59
  %73 = load i32, ptr %72, align 4, !tbaa !3
  %74 = add i32 %73, 1
  store i32 %74, ptr %72, align 4, !tbaa !3
  br label %75

75:                                               ; preds = %71, %60
  %76 = add nuw i32 %62, 1
  %77 = add nsw i64 %61, -1
  %78 = icmp sgt i64 %61, 1
  br i1 %78, label %60, label %._crit_edge

._crit_edge:                                      ; preds = %75, %48
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %79 = add nsw i64 %49, -1
  %80 = icmp sgt i64 %49, 1
  br i1 %80, label %48, label %._crit_edge172.loopexit

._crit_edge172.loopexit:                          ; preds = %._crit_edge
  %.unpack.pre = load ptr, ptr @_QFEaaa.0, align 8, !tbaa !7
  %.unpack137.unpack.unpack139.pre = load i64, ptr @_QFEaaa.8, align 8, !tbaa !7
  br label %._crit_edge172

._crit_edge172:                                   ; preds = %._crit_edge172.loopexit, %.preheader
  %.unpack137.unpack.unpack139 = phi i64 [ %.unpack137.unpack.unpack139.pre, %._crit_edge172.loopexit ], [ %33, %.preheader ]
  %.unpack = phi ptr [ %.unpack.pre, %._crit_edge172.loopexit ], [ %35, %.preheader ]
  store ptr %.unpack, ptr %1, align 8, !tbaa !7
  %.fca.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 1
  store i64 4, ptr %.fca.1.gep, align 8, !tbaa !7
  %.fca.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 2
  store i32 20180515, ptr %.fca.2.gep, align 8, !tbaa !7
  %.fca.3.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 3
  store i8 1, ptr %.fca.3.gep, align 4, !tbaa !7
  %.fca.4.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 4
  store i8 9, ptr %.fca.4.gep, align 1, !tbaa !7
  %.fca.5.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 5
  store i8 0, ptr %.fca.5.gep, align 2, !tbaa !7
  %.fca.6.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 6
  store i8 0, ptr %.fca.6.gep, align 1, !tbaa !7
  %.fca.7.0.0.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 0
  store i64 1, ptr %.fca.7.0.0.gep, align 8, !tbaa !7
  %.fca.7.0.1.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 1
  store i64 %.unpack137.unpack.unpack139, ptr %.fca.7.0.1.gep, align 8, !tbaa !7
  %.fca.7.0.2.gep = getelementptr inbounds { ptr, i64, i32, i8, i8, i8, i8, [1 x [3 x i64]] }, ptr %1, i64 0, i32 7, i64 0, i64 2
  store i64 4, ptr %.fca.7.0.2.gep, align 8, !tbaa !7
  %81 = call i32 @_FortranAMinvalInteger4(ptr nonnull %1, ptr nonnull @_QQcl.b35d0549634cdd21fe6214377dade6e3, i32 42, i32 0, ptr null)
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph175, %37, %._crit_edge172, %45
  %.2 = phi i32 [ %81, %._crit_edge172 ], [ 0, %45 ], [ 0, %37 ], [ %spec.select, %.lr.ph175 ]
  %82 = call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.b35d0549634cdd21fe6214377dade6e3, i32 45)
  %83 = call i1 @_FortranAioOutputInteger32(ptr %82, i32 %.2)
  %84 = call i32 @_FortranAioEndIoStatement(ptr %82)
  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 i32 @_FortranAMinvalInteger4(ptr, ptr, i32, i32, ptr) local_unnamed_addr

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

declare i1 @_FortranAioOutputInteger32(ptr, i32) local_unnamed_addr

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

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" }
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"}
!7 = !{!8, !8, i64 0}
!8 = !{!"descriptor member", !5, i64 0}
