题目描述:
#include<iostream> #include<string> #include<set> #include<sstream> using namespace std; set<string> dic; string s, buf; int main() { 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) dic.insert(buf); } for(set<string>::iterator it = dic.begin(); it != dic.end(); ++it) cout << *it << "\n"; return 0; }
安迪的第一个字典 (Andy's First Dictionary,UVa10815)
原文地址:https://www.cnblogs.com/secoding/p/9490649.html
时间: 2024-10-21 03:50:50