Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "xuly.h"
- #define _CRT_SECURE_NO_WARNINGS
- #include <string.h>
- void xuly(char s[], char kq[], int& d, int& maxx)
- {
- kq[0] = s[0];
- kq[1] = '\0';
- char t[51];
- int dem, k;
- do
- {
- strcpy(t,""); // sua cho nay
- dem = 0; k = 0;
- for (int i = 0; i < strlen(s); i++)
- if (s[0] == s[i])
- dem++;
- else
- {
- t[k] = s[i];
- k++;
- }
- t[k] = '\0';
- if (maxx < dem)
- {
- strcpy(kq, ""); //sua cho nay
- maxx = dem;
- kq[0] = s[0];
- d = 0;
- kq[1] = '\0';
- }
- else if (maxx == dem)
- {
- d++;
- kq[d] = s[0];
- kq[d + 1] = '\0';
- }
- strcpy(s, t);
- } while (strcmp(s, "")); //sua cho nay
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement