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 |
能帮我看一下哪里的问题么,wa:(#include<iostream> #include<map> #include<string> using namespace std; typedef map<string,int> myMap; int main(){ string s; myMap p; myMap::iterator ip; int n,i,j; bool flag; char c[50]; while(cin>>n){ while(1){ cin>>s; if(s=="EndOfText")break; for(i=0,j=0;i<s.size();i++) if(s.at(i)>='A'&&s.at(i)<='Z') { c[j]=((char)s.at(i)+32);j++;} else if(s.at(i)>='a'&&s.at(i)<='z') { c[j]=s.at(i);j++;} if(j!=0) c[j]='\0'; else continue; s=c; ip=p.find(s); if(ip==p.end()) p.insert(myMap::value_type(s,1)); else (*ip).second++; } flag=true; for(ip=p.begin();ip!=p.end();ip++) if((*ip).second==n) { cout<<(*ip).first<<endl;flag=false;} if(flag)cout<<"There is no such word."<<endl; cout<<endl; p.clear(); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator