题目:Given an input string, reverse the string word by word. For example,Given s = "the sky is blue",return "blue is sky the". 要求: 1)首尾有空格的时候,反转后的string要将空格去掉 2)当string有多个连续空格的时候,只保留一个空格. 代码分析: 对多余空格剔除: 思路分析: 1)从原始s 的最末尾开始扫描,如果遇到空格,用whil
StackX类 public class StackX{ private int maxSize; private char StackArray[]; private int top; public StackX(int max){ //构造函数的定义 maxSize=max; StackArray=new char[maxSize]; top=-1; } public void push(char j){ //字符压栈 StackArray[++top]=j; } public char p