uva10815 sstream文本读入模板

#include<bits/stdc++.h>
#include<stdio.h>
#include<algorithm>
#include<queue>
#include<string.h>
#include<iostream>
#include<math.h>
using namespace std;
#define ll long long
const int maxn=1e4+7;
const int inf=0x3f3f3f3f;
#define FOR(n) for(int i=1;i<=n;i++)
#define pb push_back

namespace fastIO{  
	#define BUF_SIZE 100000  
	#define OUT_SIZE 100000  
	#define ll long long  
	//fread->read  
	bool IOerror=0;  
	inline char nc(){  
		static char buf[BUF_SIZE],*p1=buf+BUF_SIZE,*pend=buf+BUF_SIZE;  
		if (p1==pend){  
			p1=buf; pend=buf+fread(buf,1,BUF_SIZE,stdin);  
		if (pend==p1){IOerror=1;return -1;}  
		//{printf("IO error!\n");system("pause");for (;;);exit(0);}  
	}  
	return *p1++;  
}  
inline bool blank(char ch){return ch==' '||ch=='\n'||ch=='\r'||ch=='\t';}  
inline void read(int &x){  
	bool sign=0; char ch=nc(); x=0;  
	for (;blank(ch);ch=nc());  
	if (IOerror)return;  
	if (ch=='-')sign=1,ch=nc();  
	for (;ch>='0'&&ch<='9';ch=nc())x=x*10+ch-'0';  
	if (sign)x=-x;  
}  
inline void read(ll &x){  
	bool sign=0; char ch=nc(); x=0;  
	for (;blank(ch);ch=nc());  
	if (IOerror)return;  
	if (ch=='-')sign=1,ch=nc();  
	for (;ch>='0'&&ch<='9';ch=nc())x=x*10+ch-'0';  
	if (sign)x=-x;  
}  
inline void read(double &x){  
	bool sign=0; char ch=nc(); x=0;  
	for (;blank(ch);ch=nc());  
	if (IOerror)return;  
	if (ch=='-')sign=1,ch=nc();  
	for (;ch>='0'&&ch<='9';ch=nc())x=x*10+ch-'0';  
	if (ch=='.'){  
		double tmp=1; ch=nc();  
		for (;ch>='0'&&ch<='9';ch=nc())tmp/=10.0,x+=tmp*(ch-'0');  
	}  
	if (sign)x=-x;  
}  
inline void read(char *s){  
	char ch=nc();  
	for (;blank(ch);ch=nc());  
	if (IOerror)return;  
	for (;!blank(ch)&&!IOerror;ch=nc())*s++=ch;  
	*s=0;  
}  
inline void read(char &c){  
	for (c=nc();blank(c);c=nc());  
	if (IOerror){c=-1;return;}  
} 
#undef OUT_SIZE  
#undef BUF_SIZE  
}; using namespace fastIO;

set<string>dict;
int main(){
	string s,buf;
	while(cin>>s){
		for(int i=0;i<s.length();i++)
			if(isalpha(s[i]))s[i]=tolower(s[i]);else s[i]=' ';
		stringstream ss(s);
		while(ss>>buf)dict.insert(buf);
	}
	for(set<string>::iterator it=dict.begin();it!=dict.end();++it)
		cout<<*it<<endl;
}

posted @ 2017-09-15 19:09  Drenight  阅读(141)  评论(0编辑  收藏  举报