+ 1
The spy life || won't pass test 4
Don't know why it only fails test4. Can someone help me figure out what I am missing? #include <iostream> #include <string> using namespace std; int main(){ string code; string sol; getline(cin,code); int n=0; int s = code.length (); for(int i=0;i<code.size();i++){ if((code[i]>=97&&code[i]<=122)||code[i]==32||(code[i]>=65&&code[i]<=90)){ sol[n]=code[i]; n++; }else{s--;} } for(int i=s-1;i>=0;i--){ cout<<sol[i];} return 0; }
1 Respuesta
0
In sol[n] = code[i] use sol += code [i] instead.