比赛 |
20160707 |
评测结果 |
WWWWWWWWWW |
题目名称 |
单词缩写 |
最终得分 |
0 |
用户昵称 |
风间净无尘 |
运行时间 |
0.008 s |
代码语言 |
C++ |
内存使用 |
0.31 MiB |
提交时间 |
2016-07-07 16:06:40 |
显示代码纯文本
#include<iostream>
#include<cstdio>
#include<sstream>
#include<string>
#include<vector>
using namespace std;
int main()
{
freopen("abbreviation.in","r",stdin);
freopen("abbreviation.out","w",stdout);
string line,word;
vector<string> st;
vector<string>::iterator it;
int size,i;
int tl;
string tmp,tmp1,tmp2;
while(getline(cin,line))
{
st.clear();
istringstream stream(line);
while(stream>>word)
{
if(word!="a"&&word!="an"&&word!="the"&&word!="of"&&word!="and"&&word!="for"&&word!="A"&&word!="An"&&word!="The"&&word!="Of"&&word!="And"&&word!="For"&&word!="AN"&&word!="THE"&&word!="OF"&&word!="AND"&&word!="FOR")
{
size=word.size();
for(i=0,tl=0;i<size;i++,tl++)
{
if(word[i]=='-')
break;
}
if(i==size)
{
tmp=word[0];
st.push_back(tmp);
}
else
{
tmp1=word.substr(0,tl);
tmp=tmp1[0];
st.push_back(tmp);
tmp2=word.substr(tl+1,size-tl);
tmp=tmp2[0];
st.push_back(tmp);
}
}
}
for(it=st.begin();it!=st.end();it++)
{
cout<<*it;
}
cout<<endl;
}
return 0;
}