1、找出 “明日之星”
测试用例1:
输入:Tom,Lily,Tom,Lucy,Lucy,Jack,Tom,Lucy
输出:Lucy测试用例2:
输入:Tom,Lily,Tom,Lucy,Lucy,Jack,Tom
输出:Tom测试用例3:
输入:ToM,Lily,Tom,Lucy,Lucy,Jack,ToM (违法字符)
输出:error.0001
#include<iostream>
//#include<string>
#include<vector>
#include<algorithm>
using namespace std;
struct ms
{
string ss;
int n;
};
int Find_s1_in_v(string s1, vector<ms> v)
{
for (int i = 0; i < v.size(); i++)
{
if (v[i].ss==s1)
{
return i;
}
}
return -1;
}
bool operator>(ms ms1, ms ms2)
{
if (ms1.n == ms2.n)
{
return ms1.ss < ms2.ss;
}
return ms1.n > ms2.n;
}
/*
bool operator<(ms ms1, ms ms2)
{
return ms1.ss < ms2.ss;
}*/
int main()
{
//char c;
ms ms1;
string s;
cin >> s;
vector<ms> v;
int i=-1;
int j,k;
while (true)
{
j = s.find(",", i+1);
string s1 = s.substr(i+1, j-(i + 1));
if (s1[0]>'Z'||s1[0]<'A')
{