output:
Ssihtllun sillun ehtllun elbatllun
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Codechef c=new Codechef();
String res=c.reverseword("this is the table");
System.out.println(res);
}
String reverseword(String str)
{ String test="";
int count=1;
//if(str.charAt(0)!=' ')
//count++;
for(int i=0;i<str.length();i++)
{
if(str.charAt(i)==' ')
count++;
}
String[] arr=new String[count];
int k=0;
for(int j=0;j<str.length();j++)
{
if(str.charAt(j)!=' ')
arr[k]=""+arr[k]+str.charAt(j);
else
k++;
}
for(int m=0;m<count;m++)
{
test="";
for(int p=arr[m].length()-1;p>=0;p--)
{
/*if(p==0 && (arr[0].charAt(p)>=92 && arr[0].charAt(p)<=122))
{
test+=(char)(arr[m].charAt(p)-32);
break;
}*/
test+=arr[m].charAt(p);
}
arr[m] = test;
}
arr[0] = Character.toUpperCase(arr[0].charAt(0))+arr[0].substring(0, arr[0].length());
String ans = "";
for(int i=0;i<arr.length; i++){
if(i>0) ans+=" ";
ans+=arr[i];
}
return ans;
}
}