+ 2

The spy life question on sololearn i am not getting the correct answer please correct my code

#include <bits/stdc++.h> using namespace std; int main(){ string s; string temp = " "; getline(cin,s); for(int i=0;i<s.length();i++){ if(s[i]>=65 && s[i]<=90 || s[i]>=97 && s[i]<=122 ||s[i]==32){ temp += s[i]; } } for(int i=temp.length();i>=0;i--){ cout<<temp[i]; } return 0; }

17th Aug 2020, 11:11 AM
Manthan Ambekar
Manthan Ambekar - avatar
3 Answers
+ 9
Manthan Ambekar if case, u haven't closed them properly...and second for loop shud start from length()-1 https://code.sololearn.com/cyxKTXVzszBe/?ref=app
17th Aug 2020, 11:41 AM
chaithra Gowda
chaithra Gowda - avatar
+ 2
Thanks Chaithra Gowda👑 and @swim
17th Aug 2020, 5:52 PM
Manthan Ambekar
Manthan Ambekar - avatar