Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <string.h>
- #include <stdio.h>
- using namespace std;
- main()
- {
- int i, j;
- char s[100];
- int ts[100];
- cout << " Nhap dong chu : " ; gets(s);
- for( i=0;i<strlen(s);i++){
- ts[i]=1;
- }
- for(i=0; i<strlen(s); i++){
- for( j=i+1; j<strlen(s); j++){
- if (s[i]==s[j] && ts[i]!=0)
- {
- ts[j]=0;
- ts[i]++;
- }
- }
- }
- for(i=0;i<strlen(s);i++){
- if(ts[i]!=0){
- cout << " Ki tu " << s[i]<< " xuat hien " << ts[i] << " lan\n";
- }
- }
- // getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement