+ 2
Extra-Terrestrial code not working.
My output is exactly what is expected, as far as I can tell visually. But it is saying I am wrong. https://code.sololearn.com/c7X1SP54poD6/?ref=app
13 Réponses
+ 3
You need to subtract 1 from i to make it work.
Remember an array starts at 0
Try this:
https://code.sololearn.com/c8TNoNk2PvdF/?ref=app
+ 3
Hippopotomomonstrosesquippedaliophobia, the longest word in the world (37 characters).
Debug 😎:
while(i) printf("%c", word[--i]);
+ 2
Nvm! I didn't see that you removed the = from <=
+ 2
Thank you!
+ 2
Change char word[20]; to char word[50];
+ 1
I tried that, same result :(
+ 1
It worked after that
+ 1
Whoops, sorry,
Yes i removed the <
+ 1
Just did that lol
+ 1
Thanks again haha
+ 1
Lol, sure.
It should work now
Happy coding 😉
+ 1
import java.util.*;
public class Program
{
public static void main(String[] args) {
String s,rev="";
Scanner sc=new Scanner(System.in);
s=sc.nextLine();
s=s.trim();
int l=s.length ();
for(int i=1;i<=l;i++)
rev+=s.charAt(l-i);
System.out.print(rev);
}
}
0
2 of the 5 test cases are still red, but I can't see what they are. But the first two worked. Thanks