记录编号 | 65046 | 评测结果 | ETEEETEEEE | ||
---|---|---|---|---|---|
题目名称 | [暑假培训2012] 单词缩写 | 最终得分 | 0 | ||
用户昵称 | 是否通过 | 未通过 | |||
代码语言 | C++ | 运行时间 | 2.916 s | ||
提交时间 | 2013-07-25 15:20:21 | 内存使用 | 38.46 MiB | ||
#include <fstream> #include <string> using namespace std; ifstream input ("abbreviation.in"); ofstream output ("abbreviation.out"); string b[10000001],c,q,u="for",o="the",m="and",n="The",z="For",x="And"; int main () { int a,i,j,p=0,k=0,l; input>>a; for(i=0;i<=a;i++) { getline(input,b[i]); } for(i=1;i<=a;i++) { p=0; b[i]=b[i]+' '; l=b[i].length(); c=""; for(j=0;j<l;j++) { if(b[i][j]!=' ') p++; if(b[i][j]==' ') { q=b[i].substr(j-p,p); if(p>=3&&q!=u&&q!=o&&q!=m&&q!=n&&q!=z&&q!=x) { c=c+b[i][j-p]; k++; } p=0; } } for(j=0;j<=k;j++) { if(c[j]>='a'&&c[j]<='z') c[j]=c[j]-32; } output<<c<<endl; } input.close(); output.close(); return 0; }