var readline = require("readline"); var rl = readline.createInterface({ input:process.stdin, output:process.stdout }); var dataLength = 3; // 一组数据的行数 function isIn(item, arr){ var isIn = false; for(var i = 0;i<arr.length;i++){ if(arr[i]===item){ isIn = true; break; } } return isIn; } function order(value1, value2){ return value1-value2; } var inputs = []; rl.on('line', function(data) { // 获取输入 inputs.push(data.trim()); }); rl.on("close",function(){ var res = ""; var groupLength = inputs.length/dataLength; for(var i=0;i<groupLength;i++){ var oneGroup =[]; for(var j=i*dataLength;j<dataLength*i+dataLength;j++){ oneGroup.push(inputs[j]); } if(i == groupLength-1){ res=res+handler(oneGroup); }else{ res = res+handler(oneGroup)+"\n"; } //console.log(res,"$$"); } console.log(res); }) /** * [deal description] * @param {[type]} inputs [description] * @return {[type]} [description] */ function handler(oneGroup) { var result = ''; var firstLine = oneGroup[0].trim(); var secondLine = oneGroup[1].trim(); var thirdLine = oneGroup[2].trim(); var setOne = secondLine.split(" ").map(function(item,index,arr){ return parseInt(item.trim()); }); var setTwo = thirdLine.split(" ").map(function(item,index,arr){ return parseInt(item.trim()); }); var res = [].concat(setOne); for(var i=0; i<setTwo.length;i++){ if(!isIn(setTwo[i],setOne)){ res.push(setTwo[i]); } } result = res.sort(order).join(" "); return result; }