这里的输入需要记录一下
https://vjudge.net/contest/359711#problem/G
#include<bits/stdc++.h>
#define N 10
#define endl ‘\n‘
#define _for(i,a,b) for(int i=a;i<b;i++)
using namespace std;
typedef long long ll;
set<string> Set;
int main(){
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
string s;
while( getline( cin,s ) ){
int len = s.size();
_for(i,0,len){
if( isalpha(s[i]) ){
if( s[i]<‘a‘ ) s[i]=s[i]-‘A‘+‘a‘;
}
else s[i] = ‘ ‘;
}
stringstream ss(s);
string tem;
while( ss>>tem ){
// cout<<tem<<endl;
Set.insert(tem);
}
}
for( auto i : Set) cout<<i<<endl;
return 0;
}
usingnamespacestd; typedeflonglong ll; set<string> Set; int main(){ ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); string s; while( getline( cin,s ) ){ int len = s.size(); _for(i,0,len){ if( isalpha(s[i]) ){ if( s[i]<‘a‘ ) s[i]=s[i]-‘A‘+‘a‘; } else s[i] = ‘ ‘; } stringstream ss(s); string tem; while( ss>>tem ){ // cout<<tem<<endl; Set.insert(tem); } } for( auto i : Set) cout<<i<<endl; return0; }
原文:https://www.cnblogs.com/SunChuangYu/p/12381323.html