Problem with search pattern

Can anyone help me in a scriptfor below example which has to find the string "System && Passcode 0" or "System && Failcode ??"

If this searched string occurs consecutively 4 times it should provide output as error

S.No : Program: Status

  1. was : Passcode 1
  2. System: Passcode 0
  3. System: Failcode 11
  4. System : Failcode 12
  5. war: Failcode 12
> cat sample.log
asd
asd
this
this
this
this
asd
this 
this
this
this
this
asd
asd
asd
this 
this
this
this
this
> cat checklog 
#!/bin/bash

match="this"
cnt=0
while read zf
   do
   if [ "$zf" = "$match" ]
      then
         cnt=$((cnt+1))
         echo $cnt
      else
         cnt=0
   fi
   if [ $cnt -eq 5 ]
      then
         echo "yep, it met the criteria"
   fi
done <sample.log
> checklog
1
2
3
4
1
2
3
4
5
yep, it met the criteria
1
2
3
4
5
yep, it met the criteria

You can (1) remove the echo of the cnt as it just shows the step-thru of data; (2) adjust the match criteria to what you need; etc...