#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<queue>
#define INF 0x3f3f3f3f
using namespace std;
typedef long long ll;
int n;
const int N=30,M=110;
struct Node {
char a[M];
int len,id;
}s[N];
bool cmp(Node a,Node b) {
if(a.len!=b.len) {
return a.len>b.len;
}
else if(strcmp(a.a,b.a)==1) {
return true;
}
else {
return false;
}
};
int main() {
ios::sync_with_stdio(false);
scanf("%d",&n);
for(int i=1;i<=n;i++) {
scanf("%s",s[i].a);
s[i].len=strlen(s[i].a);
s[i].id=i;
}
sort(s+1,s+n+1,cmp);
printf("%d\n%s",s[1].id,s[1].a);
return 0;
}
这是代码,把其中一个点的测试数据下载下来发现都没问题,太奇怪了。