Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RE:reversing a string program

 
Vidya Bhargavi
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


input:"welcome to cornet"
output:"emoclew ot tenroc"


Can anyone please write a program with the above specified input to get the desired output.
 
Henry Wong
author
Marshal
Pie
Posts: 21115
78
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Vidya Bhargavi wrote:Can anyone please write a program with the above specified input to get the desired output.


What have you tried? And what issues have you run into? ... and you should read this...

http://faq.javaranch.com/java/NotACodeMill

Henry
 
Miklos Szeles
Ranch Hand
Posts: 142
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, we can. And you can too;) We can help if you stucked somewhere but we won't write theprogram instead of you. So I advice you to try to do it yourself and come back some code what you wrote when you stucked.
 
Vidya Bhargavi
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,



i tried reverse method in stringbuffer class.....

but i am able to reverse the input as a whole sentence only....

i need that to be done word by word as specified above....

please give me the logic for that
 
Rob Spoor
Sheriff
Pie
Posts: 20527
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you find the word boundaries? If so, you can use those to reverse only parts of the String.
 
Vikash Ananda
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First Help:

Do some Homework

Second Help:

1. use loops
2. see for documentations
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic