题解 | #表示数字#
表示数字
https://www.nowcoder.com/practice/637062df51674de8ba464e792d1a0ac6
const rl = require("readline").createInterface({ input: process.stdin }); var iter = rl[Symbol.asyncIterator](); const readline = async () => (await iter.next()).value; let nums = '0123456789'; void async function () { // Write your code here while(line = await readline()){ let tokens = line.split(''); for(let i = 0; i< tokens.length; i++) { if((!nums.includes(tokens[i]) && nums.includes(tokens[i + 1]) || nums.includes(tokens[i]) && !nums.includes(tokens[i + 1]))) { tokens.splice(i+1, 0, '*'); i++; } } if(nums.includes(tokens[0])) tokens.unshift('*'); console.log(tokens.join('')); // let a = parseInt(tokens[0]); // let b = parseInt(tokens[1]); // console.log(a + b); } }()#华为机试题#
华为机试题 文章被收录于专栏
华为机试题