15 Answers
New Answer1)take the input directly into a String array String input[]=new Scanner(System.in).nextLine().split(" "); 2)now make a method to take String values as parameter & return reversed String . 3)run the loop through that input array [System.out.print(method (word));] //many other approaches are also possible , though its what comed in my mind after seeing this question , hope it helps☺ //want to know more about split() method & more such stuff ?
Why don't you try !? https://code.sololearn.com/cNm6ygciLbFi/?ref=app https://code.sololearn.com/cd9qdP4ts7F4/?ref=app https://code.sololearn.com/cpu2y8C1EZBN/?ref=app
Try ThisOne!;) StringReverse -> lambda expression 👍😆 https://code.sololearn.com/c3px0cuKbvYS/?ref=app
Here's a pseudo code using for loop... Initialize a new empty string called Str which = "" FOR character "Ch" till the END of the string : Str = Ch + Str Str saves the the reverse of the given string.
You can do with auxiliary string. Just initialize a empty string with same length of word and make a for-each (word) with an auxiliary count that start in index of last position and just store in the empty array in reverser order. If you do this method you don't lose original input.
1. Use array 2. StringBuilder https://code.sololearn.com/cy26M72V2D2g/?ref=app https://code.sololearn.com/cpAv2CZejx67/?ref=app
[Ans: ✓ \"] >>>"\"" " Type "\"" in the blank and click Check you will get reply as correct with a bell sound. Reason: Some characters can't be directly included in a string. For instance, double quotes can't be directly included in a double quote string; this would cause it to end prematurely. Characters like these must be escaped by placing a "backslash"[ \ ] before them. Other common characters that must be escaped are newlines and "backslashes". Double quotes only need to be escaped in double quote strings, and the same is true for single quote strings. Example: >>> 'Brian\'s mother: He\'s not the Messiah. He\'s a very naughty boy!' 'Brian's mother: He's not the Messiah. He's a very naughty boy!' Note: [ \n represents a new line ] "Backslashes" can also be used to "escape tabs", "arbitrary Unicode characters", and various other things that can't be reliably printed. These characters are known as "escape characters".
https://code.sololearn.com/cWQjYRTQs98Q/?ref=app You can use this ... Thanks!!
For reverse a word i would use a variable type char and create a method using the switch conditioner. We could add an array and join the loops for. With these resource you can use your imagine and improve yourself your skilla until you get your target program