#include
Char a [1000] [15].
Int b [1000];
Int main () {
Int n, I, j, k, Max.
While (the scanf (" % d ", & amp; N)!=(EOF)
{
If (n=0)
break;
For (I=1; i<=n; I++)
{
b[i]=0;
The scanf (" % s ", a [I]);
}
For (I=1; i<=n; I++)
{
For (j=1; J<=n; J++)
If (STRCMP (a [I], a [j])==0)
{
B [I] + +;
}
}
Max=b [1];
K=1;
For (I=2; i
If (b [I] & gt; Max)
{
Max=b [I];
K=I;
}
}
Printf (" % s \ n ", a [k]);
}
return 0;
}
The output limit exceeded what brothers rush!
CodePudding user response:
Compare that, why not compare to skip with yourself?CodePudding user response:
Which refers to the comparisonCodePudding user response:
String comparison STRCMPCodePudding user response:
# include & lt; stdio.h>
#include
Char a [1000] [15].
Int b [1000];
Int main ()
{
Int n, I, j, k, Max.
While (the scanf (" % d ", & amp; N)!=(EOF)
{
//if (n=0)
If (n==0)
break;
For (I=1; i<=n; I++)
{
b[i]=0;
The scanf (" % s ", a [I]);
}
For (I=1; i<=n; I++)
{
For (j=1; J<=n; J++)
If (STRCMP (a [I], a [j])==0)
{
B [I] + +;
}
}
Max=b [1];
K=1;
For (I=2; i{
If (b [I] & gt; Max)
{
Max=b [I];
K=I;
}
}
Printf (" % s \ n ", a [k]);
}
return 0;
}
For your reference ~
Every time the input of n will become zero.
CodePudding user response:
Above thank you friendsCodePudding user response: