Plz.... Someone Cheak it...
or Give me some test cases...
here is my code....
/*
* File: 10815 - Andy's First Dictionary.cpp
* Tag: String
* http://uva.onlinejudge.org/external/108/10815.html
* Runtime:
* Author: Shoshi
* Created on November 28, 2011, 9:00 PM
*/
#pragma warning (disable : 4786)
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <list>
#include <vector>
#include <map>
#include <sstream>
#include <cmath>
#include <bitset>
#include <utility>
#include <set>
#include <numeric>
#define INF_MAX 2147483647
#define INF_MIN -2147483647
#define pi acos(-1.0)
#define N 1000000
#define LL long long
using namespace std;
int main() {
//freopen("10815 - Andy's First Dictionary_in.txt", "r", stdin);
map<string,bool>m;
map<string,bool>::iterator it;
string str,str1;
int l,i;
while(cin>>str) {
l=str.length();
str1.clear();
for(i=0;i<l;i++) {
if((str[i]>='A' && str[i]<='Z') || (str[i]>='a' && str[i]<='z') || (str[i]>='0' && str[i]<='9')) {
str[i]=tolower(str[i]);
str1+=str[i];
}
else {
str.erase(i,1);
i--;
l--;
if(!str1.empty()) {
m[str1]=true;
str1.clear();
}
}
}
if(!str1.empty()) {
m[str1]=true;
str1.clear();
}
}
for(it=m.begin();it!=m.end();it++)
cout<<(*it).first<<endl;
return 0;
}
