character(1000) :: s,t
integer :: sLen,tLen,i,j,mx=0,tempMx
read*,s
read*,t
sLen = len_trim( s )
tLen = len_trim( t )

do i = 0,sLen-tLen
  tempMx = 0
  do j = 1,tLen
    if( s(j+i:j+i)==t(j:j) ) tempMx = tempMx + 1
  end do
  mx = max( tempMx,mx )
end do
print*,tLen-mx
end

; 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"

@_QFEmx = internal unnamed_addr global i32 0
@_QFEs = internal global [1000 x i8] undef
@_QFEt = internal global [1000 x i8] undef
@_QQcl.9f87d4a1c0dcbe45e90d47c3bdb58df7 = linkonce constant [72 x i8] c"/home/ubuntu/Downloads/TheStack_IR/Collated/Fortran/Source_691/source.f\00"
@_QQEnvironmentDefaults = local_unnamed_addr constant ptr null

define void @_QQmain() local_unnamed_addr {
  %1 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.9f87d4a1c0dcbe45e90d47c3bdb58df7, i32 3)
  %2 = tail call i1 @_FortranAioInputAscii(ptr %1, ptr nonnull @_QFEs, i64 1000)
  %3 = tail call i32 @_FortranAioEndIoStatement(ptr %1)
  %4 = tail call ptr @_FortranAioBeginExternalListInput(i32 -1, ptr nonnull @_QQcl.9f87d4a1c0dcbe45e90d47c3bdb58df7, i32 4)
  %5 = tail call i1 @_FortranAioInputAscii(ptr %4, ptr nonnull @_QFEt, i64 1000)
  %6 = tail call i32 @_FortranAioEndIoStatement(ptr %4)
  br label %7

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

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

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

26:                                               ; preds = %18
  %27 = select i1 %11, i32 0, i32 %17
  %28 = trunc i64 %19 to i32
  %29 = add i32 %28, 1
  %30 = select i1 %22, i32 0, i32 %29
  %31 = sub i32 %27, %30
  %32 = sext i32 %31 to i64
  %33 = add nsw i64 %32, 1
  %34 = icmp sgt i32 %31, -1
  br i1 %34, label %.lr.ph19, label %._crit_edge20

.lr.ph19:                                         ; preds = %26
  %35 = icmp sgt i32 %30, 0
  br i1 %35, label %.lr.ph.us.preheader, label %.lr.ph19.split

.lr.ph.us.preheader:                              ; preds = %.lr.ph19
  %36 = zext i32 %30 to i64
  br label %.lr.ph.us

.lr.ph.us:                                        ; preds = %.lr.ph.us.preheader, %._crit_edge.us
  %indvars.iv27 = phi i64 [ 0, %.lr.ph.us.preheader ], [ %indvars.iv.next28, %._crit_edge.us ]
  br label %37

37:                                               ; preds = %.lr.ph.us, %37
  %indvars.iv = phi i64 [ 1, %.lr.ph.us ], [ %indvars.iv.next, %37 ]
  %.017.us = phi i32 [ 0, %.lr.ph.us ], [ %spec.select.us, %37 ]
  %38 = add nuw nsw i64 %indvars.iv, %indvars.iv27
  %sext = shl i64 %38, 32
  %39 = ashr exact i64 %sext, 32
  %40 = add nsw i64 %39, -1
  %41 = getelementptr [1000 x [1 x i8]], ptr @_QFEs, i64 0, i64 %40
  %42 = add nsw i64 %indvars.iv, -1
  %43 = getelementptr [1000 x [1 x i8]], ptr @_QFEt, i64 0, i64 %42
  %44 = tail call i32 @_FortranACharacterCompareScalar1(ptr %41, ptr %43, i64 1, i64 1)
  %45 = icmp eq i32 %44, 0
  %46 = zext i1 %45 to i32
  %spec.select.us = add i32 %.017.us, %46
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv, %36
  br i1 %exitcond.not, label %._crit_edge.us, label %37

._crit_edge.us:                                   ; preds = %37
  %47 = load i32, ptr @_QFEmx, align 4, !tbaa !3
  %48 = tail call i32 @llvm.smax.i32(i32 %spec.select.us, i32 %47)
  store i32 %48, ptr @_QFEmx, align 4, !tbaa !3
  %indvars.iv.next28 = add nuw nsw i64 %indvars.iv27, 1
  %exitcond30.not = icmp eq i64 %indvars.iv27, %32
  br i1 %exitcond30.not, label %._crit_edge20, label %.lr.ph.us

.lr.ph19.split:                                   ; preds = %.lr.ph19
  %_QFEmx.promoted = load i32, ptr @_QFEmx, align 4, !tbaa !3
  %49 = add nsw i64 %32, 2
  %smin = tail call i64 @llvm.smin.i64(i64 %33, i64 1)
  %50 = sub i64 %49, %smin
  %min.iters.check = icmp ult i64 %50, 8
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %.lr.ph19.split
  %n.vec = and i64 %50, -8
  %ind.end = sub i64 %33, %n.vec
  %minmax.ident.splatinsert = insertelement <4 x i32> poison, i32 %_QFEmx.promoted, i64 0
  %minmax.ident.splat = shufflevector <4 x i32> %minmax.ident.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %51, %vector.body ]
  %vec.phi39 = phi <4 x i32> [ %minmax.ident.splat, %vector.ph ], [ %52, %vector.body ]
  %51 = tail call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi, <4 x i32> zeroinitializer)
  %52 = tail call <4 x i32> @llvm.smax.v4i32(<4 x i32> %vec.phi39, <4 x i32> zeroinitializer)
  %index.next = add nuw i64 %index, 8
  %53 = icmp eq i64 %index.next, %n.vec
  br i1 %53, label %middle.block, label %vector.body, !llvm.loop !7

middle.block:                                     ; preds = %vector.body
  %rdx.minmax.select = tail call <4 x i32> @llvm.umax.v4i32(<4 x i32> %51, <4 x i32> %52)
  %54 = tail call i32 @llvm.vector.reduce.smax.v4i32(<4 x i32> %rdx.minmax.select)
  %cmp.n = icmp eq i64 %50, %n.vec
  br i1 %cmp.n, label %._crit_edge20.split, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %.lr.ph19.split, %middle.block
  %.ph = phi i32 [ %_QFEmx.promoted, %.lr.ph19.split ], [ %54, %middle.block ]
  %.ph40 = phi i64 [ %33, %.lr.ph19.split ], [ %ind.end, %middle.block ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %55 = phi i32 [ %57, %scalar.ph ], [ %.ph, %scalar.ph.preheader ]
  %56 = phi i64 [ %58, %scalar.ph ], [ %.ph40, %scalar.ph.preheader ]
  %57 = tail call i32 @llvm.smax.i32(i32 %55, i32 0)
  %58 = add nsw i64 %56, -1
  %59 = icmp sgt i64 %56, 1
  br i1 %59, label %scalar.ph, label %._crit_edge20.split, !llvm.loop !10

._crit_edge20.split:                              ; preds = %scalar.ph, %middle.block
  %.lcssa = phi i32 [ %54, %middle.block ], [ %57, %scalar.ph ]
  store i32 %.lcssa, ptr @_QFEmx, align 4, !tbaa !3
  br label %._crit_edge20

._crit_edge20:                                    ; preds = %._crit_edge.us, %._crit_edge20.split, %26
  %60 = tail call ptr @_FortranAioBeginExternalListOutput(i32 -1, ptr nonnull @_QQcl.9f87d4a1c0dcbe45e90d47c3bdb58df7, i32 15)
  %61 = load i32, ptr @_QFEmx, align 4, !tbaa !3
  %62 = sub i32 %30, %61
  %63 = tail call i1 @_FortranAioOutputInteger32(ptr %60, i32 %62)
  %64 = tail call i32 @_FortranAioEndIoStatement(ptr %60)
  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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.smax.v4i32(<4 x i32>, <4 x i32>) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i32 @llvm.vector.reduce.smax.v4i32(<4 x i32>) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <4 x i32> @llvm.umax.v4i32(<4 x i32>, <4 x i32>) #0

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { nocallback nofree nosync nounwind 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 = distinct !{!7, !8, !9}
!8 = !{!"llvm.loop.isvectorized", i32 1}
!9 = !{!"llvm.loop.unroll.runtime.disable"}
!10 = distinct !{!10, !9, !8}
