function ReverseWordsInString(s: string) {
let sb: string[] = [];
let arr: string[] = s.split(" ");
for (let i: number = arr.length - 1; i >= 0; i--) {
sb.push(arr[i]);
}
return sb.join(" ").trim();
}
let s: string = "typescript c php python c++";
s = ReverseWordsInString(s);
console.log(s);
/*
run:
"c++ python php c typescript"
*/