+ 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
2 ответов
+ 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
+ 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;
}