#include<iostream.h> #include<string> int main() { char a[100]; char b[100]; int c[100]={0,0,0,0,0,0,},i,j,n=0; cout<<"Nhap vao chuoi ki tu"<<endl; cin>>a; //doan chinh for(i=0;i<strlen(a);i++) for(j=0;j<=n if(a==b[j]) {c[j]+=1;break;} else { j++; if(j>n) { b[n]=a; c[n]+=1; n=j;break; } } //khi lay gia tri cua strlen(b) no + them toi 100 le may do tuy vao len(a) a[n]='\0'; for(i=0;i<(strlen(b)-100);i++) cout<<"tu "<<b<<" xuat hien "<<c<<" lan"<<endl; return 0; }