0
import java.io.*;
class revStr
{
public static void main(String args[])throws IOException
{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the String");
String st=in.readLine();
int l,i,p;
String b="";
st=" "+st;
l=st.length();
p=l;
for(i=l-1;i>=0;i--)
{
if(st.charAt(i)==' ')
{
b=b+st.substring(i,p);
p=i;
}
}
System.out.println(b);
}
}
class revStr
{
public static void main(String args[])throws IOException
{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Enter the String");
String st=in.readLine();
int l,i,p;
String b="";
st=" "+st;
l=st.length();
p=l;
for(i=l-1;i>=0;i--)
{
if(st.charAt(i)==' ')
{
b=b+st.substring(i,p);
p=i;
}
}
System.out.println(b);
}
}
PraneetBala
Feb 10, '13
1 answers
0
Congratulations! Please post the question clearly next time so as to make it clear what exactly your code is supposed to do.
khanmansoor
Feb 10, '13
Log in to your account to answer this questions.