Write a program to take input a line from stdin. You have to reverse every word of this line, except for the starting and ending line of the words. For example, for the following input:
Example: reverse every word
function reverseWords(str) {
const allWords = str.split(" ")
return allWords.map(item => item.split("").reverse().join("")).join(" ")
}