---
# System prepended metadata

title: UVa 10815 - Andy's First Dictionary

---

# UVa 10815 - Andy's First Dictionary

---
# 題目大意
給許多英文句子，將每個單字拆開轉成小寫後，最後按照字典序輸出。每個單字指以任何符號、空格格開。比方說$three-eyed$要拆成$three$和$eyed$。

---
# 題解
一行一行讀入，每讀一行就將所有符號換成空格、大寫轉小寫，接著掃一遍把單字扔進$vector$中，最後在一起排序及去重，然後輸出。

---
```=C++
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define pf push_front
#define ft first
#define sec second
#define pr pair<int,int>
#define ISCC ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
int t ,n ,m;
string s ,tp;
vector<string> a;
inline void sol()
{
	tp = "";
	for(int i=0 ;i<s.size() ;i++)
	{
		if('a'<=s[i] && s[i]<='z') tp += s[i];
		else if(tp!="") a.pb(tp) ,tp="";
	}
	if(tp!="") a.pb(tp);
}
int main() 
{
	while(getline(cin,s))
	{
		for(int i=0 ;i<s.size() ;i++)
		{
			if(!(('a'<=s[i] && s[i]<='z') || ('A'<=s[i] && s[i]<='Z'))) s[i] = ' ';
			if('A'<=s[i] && s[i]<='Z') s[i] += 32;
		}
		sol(); 
	}
	sort(a.begin() ,a.end());
	a.erase(unique(a.begin() ,a.end()) ,a.end());
	for(auto v:a) cout << v << '\n';
	return 0;	
}
```