You are not logged in. Please login at to post your questions!


solution to question, that how to reverse the string from any point, in java

To print any type of string in this order example " My Name Is" output should be in this format " yM emaN sI" every word in the string has to be reversed individually.

asked 16 Sep '17, 15:09

avikshit123's gravatar image

accept rate: 0%

According to me, if you a reversing a string from a certain point, you could assign it to a char[] array and run two decrementing loops. If you want to reverse each word separately, read from the console using and reverse individual word using char[] array.
You could also refer to this link:


answered 16 Sep '17, 17:05

arnavvarshney's gravatar image

accept rate: 12%

Please accept the answer, if it was helpful!

(12 Oct '17, 16:20) arnavvarshney3★

Well, if you are using java

If you are sure that words are broken by only having space between them, you can use following idea...

String s = your string

String[] ar = s.split (" ");

String out = "";

For(int i=0; i < ar.length; i++){

Out += new StringBuilder (ar [i]).reverse ().toString () + " ";


System.out.printlnt (out);

In C++, you can add each word to a vector and then run a loop on teachhis vector, running a backward loop on each word and appending to output string...

Please UPVOTE and Accept this answer if you find this helpful......


answered 16 Sep '17, 17:46

taran_1407's gravatar image

accept rate: 24%

toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 16 Sep '17, 15:09

question was seen: 316 times

last updated: 12 Oct '17, 16:20