.model small
.data
str1 db ' a b c ','$'
len equ $-str1
cntr dw ?
.code
mov ax,@data
mov ds,ax
mov ah,09h
LEA DX,str1
int 21h
LEA DI,str1
mov BX,0000
mov SI,0000
mov cntr,len
sub cntr,1
L1:
mov ah,str1[SI]
cmp ah,' '
je remove
INC SI
cmp SI,cntr
jge ext
jmp L1
remove:
mov BX,SI
R1:
mov ah,str1[BX+1]
mov str1[BX],ah
cmp BX,len
jge ChangeLen
add BX,1
jmp R1
ChangeLen:
mov str1[BX],'$'
sub cntr,1
jmp L1
ext:
mov ah,09h
LEA DX,str1
int 21h
mov ax,4C00h
int 21h
end