比赛 |
20160707 |
评测结果 |
WAWWWWWWWW |
题目名称 |
单词缩写 |
最终得分 |
10 |
用户昵称 |
Lovelove_boii |
运行时间 |
0.006 s |
代码语言 |
C++ |
内存使用 |
0.31 MiB |
提交时间 |
2016-07-07 15:58:38 |
显示代码纯文本
#include<fstream>
#include<string>
using namespace std;
ifstream cin("abbreviation.in");
ofstream cout("abbreviation.out");
int t;
int main()
{
cin>>t;
string laji;
getline(cin,laji);
for(int i=1;i<=t+1;i++)
{
string words="";
getline(cin,words);
words+=' ';
string ans="";
while(!words.empty())
{
int count=0;
string word="";
while(words[count]!=' ')
{
word+=words[count];
count++;
}
if(word.length()<3||word=="and"||word=="And"||word=="aNd"||word=="anD"||word=="ANd"||word=="AnD"||word=="aND"||word=="AND"||word=="for"||word=="For"||word=="fOr"||word=="foR"||word=="FOr"||word=="FoR"||word=="fOR"||word=="FOR"||word=="the"||word=="The"||word=="tHe"||word=="thE"||word=="THe"||word=="ThE"||word=="tHE"||word=="THE")
{
words.erase(words.begin(),words.begin()+word.length()+1);
}
else
{
if(word[0]>='A'&&word[0]<='Z')
{
ans+=word[0];
}
if(word[0]>='a'&&word[0]<='z')
{
ans+=word[0]-'a'+'A';
}
words.erase(words.begin(),words.begin()+word.length()+1);
}
}
cout<<ans<<endl;
}
cin.close();
cout.close();
return 0;
}