Professional Documents
Culture Documents
Message
Message
h>
#include<string.h>
#include<math.h>
*ara1='\0';
}
int scmp(char ara1[],char ara2[])
{
int j=0;
while(1)
{
if(ara1[j]=='\0' && ara2[j]=='\0')
{
return 1;
}
else if(ara1[j]=='\0')
{
return 3;
}
else if(ara2[j]=='\0')
{
return 2;
}
else if(ara1[j]>ara2[j])
{
return 2;
}
else if(ara1[j]<ara2[j])
{
return 3;
}
j++;
}
}
char str[1000001];
int serial[1000001];
char word[1000001][5];
char word2[1000001][5];
scopy(word[c],word2[m+j+1]);
c++;
j++;
}
scopy(word[c],word2[l+i]);
c++;
i++;
}
scopy(word[c],word2[l+i]);
c++;
i++;
else if(scmp(word2[l+i],word2[m+j+1])==2)
{
scopy(word[c],word2[m+j+1]);
c++;
j++;
}
sorting(l, m, r, i, j, c);
int main()
{
scanf("%[^\n]s",str);
int c=0,i,j;
int n=strlen(str);
if(n>=4)
{
word[c][0]=word2[c][0]=str[0];
word[c][1]=word2[c][1]=str[1];
word[c][2]=word2[c][2]=str[2];
word[c][3]=word2[c][3]=str[3];
word[c][4]=word2[c][4]='\0';
c++;
}
c++;
int l=0;
int r=c-1;
merged(l,r);
//if length of word array is less than 4,c will be 0;
if(c==0)
{
printf("\n");
}
else
{
int maxc=1;
int cnt=1;
int f1=0,f2=0;//f1 is the frequency of any string
//f2 is the frequency of the string that occurs the highest
time
for(i=0;i<c-1;i=i+1)
{
if(scmp(word[i],word[i+1])==1)
{
cnt++;
}
else
{
if(cnt==maxc)
{
serial[f1]=i;
f1++;
cnt=1;
f2=f1;
}
else if(cnt>maxc)
{
maxc=cnt;
cnt=1;
f2=1;
f1=0;
serial[f1]=i;
f1++;
}
}
if(cnt==maxc)
{
serial[f1]=i;
f1++;
cnt=1;
f2=f1;
}
else if(cnt>maxc)
{
maxc=cnt;
cnt=1;
f2=1;
f1=0;
serial[f1]=i;
f1++;
}
for(i=0;i<f2;i=i+1)
{
printf("%s\n",word[serial[i]]);
}
}
return 0;
}