|  | 
|  | 
| вернуться в форум | Why WA#1?? Help me, please!! #include <bits/stdc++.h>
 using namespace std;
 string a,b;
 string re(long long c, long long d,string x){
 string y="";
 for(long long i=d; i>=c; i--) y=y+x[i];
 return y;
 }
 string re2(string x){
 long long t=0;
 string res="";
 for(long long i=0; i<x.size(); i++){
 int q=(int)x[i];
 if(q<65||(q>90&&q<97)||q>122){
 res=res+re(t,i-1,x);
 res=res+x[i];
 t=i+1;
 }
 }
 res=res+re(t,x.size()-1,x);
 return res;
 }
 int main()
 {
 while(getline(cin,a)){
 istringstream iss;
 iss.clear();
 iss.str(a);
 while(iss>>b) cout<<re2(b)<<" ";
 cout<<endl;
 }
 }
Re: Why WA#1?? Help me, please!! In the end you write empty line. You must delete your last cout.Re: Why WA#1?? Help me, please!! Thanks you. But I repaired and still WA#1Re: Why WA#1?? Help me, please!! Try next tests(be attentive to the newline and whitespace):1)
 asdad asd
 
 sf dv
 answer:
 dadsa dsa
 
 fs vd
 
 2)1
 2
 3
 $
 asd#!@#sad%$#%2 sdSA d!23!`123?<M@! ^^&(&*^&as asf kljdka jd1892u31ASDASD11
 
 end.
 answer:
 1
 2
 3
 $
 dsa#!@#das%$#%2 ASds d!23!`123?<M@! ^^&(&*^&sa fsa akdjlk dj1892u31DSADSA11
 
 dne.
 3)You must inverse word and all.
 But  y ou   could forget about the
 spaces and        line breaks
 
 !
 answer:
 uoY tsum esrevni drow dna lla.
 tuB  y uo   dluoc tegrof tuoba eht
 secaps dna        enil skaerb
 
 !
Re: Why WA#1?? Help me, please!! Oh, I failed in test 1 and then got AC. Tks u so much ^^
 Edited by author 05.02.2017 21:40
 | 
 | 
|