Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <time.h>
- #include <iostream>
- #include <math.h>
- #include <windows.h>
- #include <stdlib.h>
- using namespace std;
- char *word(char *str)
- {
- int b,l=1,i,k=0,kil,u;
- char q,max;
- int w;
- while(l<strlen(str))
- {
- i=strlen(str)-1;
- w=0;
- while(i>=0)
- {
- if(str[strlen(str)-l]==str[i])
- {
- q=str[i];
- w=w+1;
- k=k+1;
- }
- i=i-1;
- if(k==1)
- u=w;
- }
- if(w>=u)
- {
- max=q;
- kil=w;
- }
- l=l+1;
- }
- return word;
- }
- int main()
- {
- int b,l=1,i,k=0,kil,u;
- const int n=256;
- char str[n];
- char *f;
- char q,max;
- int w;
- cout<<"Введіть слово"<<endl;
- gets(str);
- f=word(str);
- word(&str);
- cout<<endl<<"Кількість повторень="<<kil<<endl<<"Літера яка найчастіше повторюється"<<max;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement