; Template for console application
         .586
         .MODEL  flat, stdcall
         OPTION CASEMAP:NONE

Include kernel32.inc
Include masm32.inc

IncludeLib kernel32.lib
IncludeLib masm32.lib

         .CONST
MsgExit  DB    "Press Enter to Exit",0AH,0DH,0

         .DATA
Flag     BYTE   0
S        BYTE   'ABCDE'
Table    BYTE   'ARTYG','FGJJU'
         BYTE   'FGHJK','ABCDY'
         BYTE   'ABCDE','FTYRG'
         
         .DATA?
inbuf    DB     100 DUP (?)

         .CODE
Start:
         lea    ESI,S
         lea    EDI,Table
         mov    ECX,6
         mov    BL,1
         cld
Cycle:   push   ESI
         push   EDI
         push   ECX
         mov    ECX,5   
    repe cmpsb
         pop    ECX
         pop    EDI
         pop    ESI
         je     Found
         add    EDI,5
         inc    BL
         loop   Cycle
         jmp    Not_Found
Found:   mov   Flag,BL
Not_Found:
         XOR    EAX,EAX
         Invoke StdOut,ADDR MsgExit
         Invoke StdIn,ADDR inbuf,LengthOf inbuf		
	
         Invoke ExitProcess,0
         End    Start

