// The string is flipped by words. The string is flipped by letters and then flipped by words.
String str1 = "12345 67890 ";
String str2 = "";
String str3 = "";
For (int o = str1.length-1; O> = 0; o --)
Str2 + = str1 [O]; // flip by letter
Char [] Charr = new char [str1.length];
Int I = 0;
Int J = 0;
Int Index = 0;
While (index <str2.length-1)
{
If (str2 [Index] = '')
{
J = index-1;
While (I <= J)
{
Charr [I] = str2 [J];
Charr [J] = str2 [I];
I ++;
J --;
}
Index ++;
I = index;
}
Else
{
Index ++;
}
}
If (Index = str2.length-1)
{
J = index;
While (I <= J)
{
Charr [I] = str2 [J];
Charr [J] = str2 [I];
I ++;
J --;
}
}
For (int K = 0; k <str2.length; k ++)
Str3 + = Charr [K]. tostring (); // flip by word
Console. writeline ("the reverse letter by letter of {0} is {1}", str1, str2 );
Console. writeline ("the reverse word by word of {0} is {1}", str1, str3 );
Console. Readline ();