let str = readline(); function getStr(str){ let res; let returnStr; let resArr = []; let reg = /([a-zA-Z]+)/g; returnStr = str.match(reg); for(let i = returnStr.length - 1; i>=0; i--){ if(returnStr[i].trim().length>20){ throw new Error('输入值错误'); } resArr.push(returnStr[i].trim()) } console.log(resArr.join(' ')); } getStr(str);