比赛 20150711暑期B班 评测结果 AAWWWWWWWW
题目名称 单词缩写 最终得分 20
用户昵称 1azyReaper 运行时间 0.007 s
代码语言 C++ 内存使用 0.32 MiB
提交时间 2015-07-11 11:04:21
显示代码纯文本
#include <fstream>
#include <string>
#include <cstring>
using namespace std;
ifstream fin("abbreviation.in");
ofstream fout("abbreviation.out");
int main()
{
	int n;
	char ch;
	//char str[1001];
	string str,s;
	fin>>n;
	while((fin>>str))
	{
		ch=fin.get();
		//fout<<str<<' ';
		if(str!="and"&&str!="for"&&str!="the"&&str!="And"&&str!="For"&&str!="The"&&str!="AND"&&str!="FOR"&&str!="THE"&&str!="ANd"&&str!="FOr"&&str!="THe"&&(str.length()>=3))
		{
			if(str[0]>='a'&&str[0]<='z')
				str[0]-=32;
			s=s+str[0];
			//fout<<s<<endl;
			if(ch==10||ch==13||ch==EOF)
			{
				fout<<s<<endl;
				int l;
				l=s.length();
				s.erase(0,l);
			}
			else
				continue;
		}
		else
			continue;
	}
	fin.close();
	fout.close();
	return 0;
}//Write by XPK