Question: Swift: import Foundation /* * Complete the function below. */ func superStack(operations: [String]) -> Void { } var operations_cnt = 0 operations_cnt = Int(readLine()!)! var
Swift:

import Foundation
/*
* Complete the function below.
*/
func superStack(operations: [String]) -> Void {
}
var operations_cnt = 0
operations_cnt = Int(readLine()!)!
var operations = [String](repeating: " ", count: operations_cnt)
for operations_i in 0 ..
var operations_item = ""
if let operations_item_temp = readLine() {
operations_item = operations_item_temp
}
operations[operations_i] = operations_item
}
var res = superStack(operations: operations)
Implement a stack that accepts the following commands and performs the operations described: push v. Push integer vonto the top of the stack pop: Pop the top element from the stack inci v. Add v to each of the bottom i elements of the stack After each operation, print the value at the top of the stack. If the stack is empty, print the string 'EMPTY
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
