class Stack { constructor(item) { this.item = item; this.arr = []; } push(item) { this.arr.push(item); } pop() { return this.arr.length === 0 ? 'error' : this.arr.pop(); } top() { return this.arr.length === 0 ? 'error' : this.arr[this.arr.length-1]; } } const readline = require('readline'); const st...