• 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!
    ");system("pause");for (;;);exit(0);}  
    	}  
    	return *p1++;  
    }  
    inline bool blank(char ch){return ch==' '||ch=='
    '||ch=='
    '||ch=='	';}  
    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;
    }

  • 相关阅读:
    HDU 3277 Marriage Match III(最大流+二分+并查集)
    HDU 3032 Nim or not Nim?(博弈,打表找规律)
    2013南京邀请赛小结——ACM两年总结
    HDU 2829 Lawrence (斜率DP)
    HDU 3530 Subsequence(单调队列)
    HDU 1525 Euclid's Game(博弈)
    C Count The Carries(2013南京邀请赛C题)
    A Play the Dice (2013南京邀请赛A题)
    POJ 3017 Cut the Sequence(单调队列+set)
    Jquery TreeView
  • 原文地址:https://www.cnblogs.com/Drenight/p/8611261.html
Copyright © 2020-2023  润新知