+ 1

Why my code isn't passing Test Case 5 of The Spy Life

Here is my code: https://code.sololearn.com/cAZbT5nHZ4Ee/?ref=app My code is passing 4 cases out of 5. I don't know what's the problem. Is there alternate function of gets in C

9th Feb 2020, 5:06 AM
Devender Kumar
Devender Kumar - avatar
2 Respostas
+ 3
Why r u shifting non alphabets to right? Space will also shift to right. See this code once. https://code.sololearn.com/cftKGF50GwRH/?ref=app
9th Feb 2020, 7:56 AM
Peter Parker
Peter Parker - avatar
+ 1
#include <iostream> using namespace std; int main() { int i; string s; string n; getline(cin,s); for( i=0; s[i] !='\0'; i++){} i--; for(; i>=0; i--) if((int(s[i])>64 && int(s[i])<91)||(int(s[i])>96 && int(s[i])<123) || (int(s[i])==32) ) n+=s[i]; cout<<n; return 0; }
9th Feb 2020, 6:24 AM
Rasul YeaBari Sun Beam
Rasul YeaBari Sun Beam - avatar