public static char[] reverseWords(char [] input) {
		int len = input.length;
		int firstIndex = 0;
		int lastIndex = 0;
		
		while(firstIndex < len && lastIndex < len) {
			while(firstIndex < len && input[firstIndex] == ' ') {
				firstIndex ++;
			}
			lastIndex = firstIndex;
			while(lastIndex < len ) {
				if(input[lastIndex] == ' ' && lastIndex -1 >=0 && input[lastIndex-1] != ' ' ) {
					break;
				}
				else {
					lastIndex ++;
				}
			}
			lastIndex = lastIndex -1;					
			reverse(input,firstIndex,lastIndex);
			firstIndex = lastIndex + 1;			
		}	
		reverse(input,0,len-1);
		return input;
	
	}