program main implicit none integer::N,i,j,M character*14::a integer::days(14) integer::days2(14) data days/14*0/ read *,N read *,a(1:7) read *,a(8:14) do i=1,14 if(a(i:i).eq.'o') days(i) = 1 end do M = 0 do i=1,14-N+1 days2 = days days2(i:i+N-1) = 1 M = MAX(M,get_longest(days2)) end do print '(i0)', M contains function get_longest(days2) result(L) integer::days2(14),L,M integer::i L = 0 M = 0 do i=1,14 if(days2(i).eq.1) then M = M + 1 else L = MAX(L,M) M = 0 end if end do L = MAX(L,M) end function get_longest end program main