- data segment
- buff db 'good morning good night good evening',0ah,0dh,'$'
- aa db $-buff
- zz db ?
- data ends
- code segment
- assume cs:code,ds:data
- start:
- mov ax,data
- mov ds,ax
- xor al,al
- mov cl,aa
- mov si,offset buff
- pp: dec cl
- inc si
- mov bl,buff[si]
- cmp bl,'n'
- jz add1
- cmp cl,0
- jnz pp
- mov dl,al
- add dl,30h
- add1: inc al
- cmp cl,0
- jnz pp
- mov zz,al
- mov ah,02h
- int 21h
- mov ax,4c00h
- int 21h
- code ends
- end start