{filelink=12230}
import java.util.Stack;
import java.util.StringTokenizer;
public class Mots_Inverse
{
public static void main (String[] args)
{
String str = "Bienvenu sur mesexemples.com";
Stack stack = new Stack();
StringTokenizer strTok = new StringTokenizer(str);
while(strTok.hasMoreTokens())
{
stack.push(strTok.nextElement());
}
StringBuilder str_reverse = new StringBuilder();
while(!stack.empty())
{
str_reverse.append(stack.pop());
str_reverse.append(" ");
}
System.out.println("Chaîne originale: " + str);
System.out.println("Chaîne inversée: " + str_reverse);
}
}