  ; nhap chuoi ki tu va hien thi ku tu thuong sang in hoa roi in ra man hinh         
  ;thogn ke xem co bao nhieu ki tu hoa, thuong va khac
 title ChuoiKT
 .Model small
 .Stack 100h
 .data
 Chuoi1 db 'Moi nhap chuoi ki tu:$'
 Chuoi2 db 13,10,'Chuoi ki tu sau khi nhap la:$'   
 Chuoi3 db 13,10,'Thong ke nhu sau:$'     
 Chuoi4 db 13,10,'So ki tu thuong la:$'   
 Chuoi5 db 13,10,'So ki tu hoa la:$'    
 Chuoi6 db 13,10,'So ki tu khac la:$'                                            
 
 A db 128 dup(?)
 I dw 0    
 dem1 db 0      
 dem2 db 0
 dem3 db 0
 .Code
 main proc
    Mov ax,@data
    Mov ds,ax
    Mov es,ax
    
    Lea dx,Chuoi1
    Mov ah,9
    int 21h
     Lea di,A
     CLD 
     
     Lap:   
       Mov ah,1
       int 21h  
       
       Cmp al,0dh
       jz Ketthuc
       
       Cmp al, 'a'
       jb ChuHoa
       cmp al,'z'
       ja HienKT 
       
       Inc dem1
       Xor al,20h    ;doi sang ki tu hoa  
        
       HienKT:   
      
       STOSB
       INC I  
       Jmp tiep  
       
       ChuHoa: 
       Cmp al,'A'
       JB KTKhac
       Cmp al,'Z'
       Ja HienKT
       Inc dem2  
       jmp tiep
       KTKhac:  
       
       Inc dem3 
        
        tiep:
       Jmp Lap 
            
       Ketthuc:
       
       Mov ah,9
       lea dx,Chuoi2
       int 21h
       
       Mov CX,I
       lea SI,A
       CLD
       Lap1:
       LODSB
       mov dl,al
       mov ah,2
       int 21h
       Loop Lap1   
       
       Mov ah,9
       lea dx,Chuoi3        ;thong ke
       int 21h   
       
       Lea dx,Chuoi4        ;dem so ki tu thuong
       int 21h  
       Mov ah,0
       mov al,dem1
       Mov bl,10
       Div bl
       Add ah,30h
       Add al,30h
       Mov bx,ax
        
      mov ah,2 
      mov dl,bl
      int 21h
      mov dl,bh
      int 21h  
       
       mov ah,9
       lea dx,Chuoi5        ; dem so ki tu hoa
       int 21h
       Mov ah,0
       mov al,dem2
       Mov bl,10
       Div bl
       Add ah,30h
       Add al,30h
       Mov bx,ax
        
      mov ah,2 
      mov dl,bl
      int 21h
      mov dl,bh
      int 21h  
        
      mov ah,9
      lea dx,Chuoi6         ;dem so ki tu khac
      int 21h
      call inso
       
       mov ah,4Ch
       int 21h   
      main endp 
      inso proc 
         Mov ah,0
       mov al,dem3
       Mov bl,10
       Div bl
       Add ah,30h
       Add al,30h
       Mov bx,ax
        
      mov ah,2 
      mov dl,bl
      int 21h
      mov dl,bh
      int 21h  
      
        ret
        inso endp 
    
 End main
       
     
 