## mihal

Ok, so far i have 2 strings inputed from keyboars into stringA and stringB, defined as db
now i need to count how many times is string B appearing in A and output that number.
Max lenght of strings is 29.
I think it should be done in 2 loop, to run throgh bouth string,
Can anyone help?

## Salem 5,138

That sounds like a reasonable approach.

## mihal

thats fine but now in need to print di which i uses as a counter, how to do it?

## JobMatchNow

Is two loops even alot?

## Salem 5,138

Well you use 'divide by 10' and 'modulo 10' to extract each digit from the number, then add '0' to the result to get a printable character.

123 / 10 = 12
123 % 10 = 3
Take the 3, add '0' to it to get '3'
The only minor problem being that it gives you the digits in reverse order, but that shouldn't be that hard to solve.

## mihal

Jeah in other words pul it all on Stack:) I used somthing simmilar:
First it writes message, then prints counter. Hers the code hope it helps someone, cheers

Print|Count proc far
push si
push ax

mov dx,offset message1
mov ah,09
int 21h

mov bx,10

mov si,2
mov ah,0
mov al,counter

Base10:

mov dx,0 ; zero devide
div bx