| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
help!!!#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef vector <string> stringVec;
typedef vector <stringVec> three;
int main()
{
int d;
cin>>d;
vector <string> ini;//(26);
vector <stringVec> ini2(27,ini);
vector <three> dic(26,ini2);//3d ARRAY!!!!
string read;
for (int i=0;i<d;i++)
{
cin>>read;
if (read.size()>1)
dic[int(read[0])-'a'][int(read[1])-'a'].push_back(read);
else
dic[int(read[0])-'a'][26].push_back(read);
}
int e;
cin>>e;
for (int c=1;c<=e;c++)
{
int wrong=0;
while (1)
{
cin>>read;
if (read=="-1")
{
break;
}
if (read.length()>1)
for (i=0;i<dic[int(read[0])-'a'][int(read[1])-'a'].size();i++)
if (read==dic[int(read[0])-'a'][int(read[1])-'a'][i])
break;
else
for (i=0;i<dic[int(read[0])-'a'][26].size();i++)
if (read==dic[int(read[0])-'a'][26][i])
break;
if (i==dic[int(read[0])-'a'][int(read[1])-'a'].size() || i==dic[int(read[0])-'a'][26].size())
{
wrong++;//.push_back(read);
if (wrong==1)
cout<<"Email "<<c<<" is not spelled correctly."<<endl;
cout<<read<<endl;
}
}
if (wrong==0)
cout<<"Email "<<c<<" is spelled correctly."<<endl;
}
cout<<"End of Output"<<endl;
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator