local C={}C.__index=C function C.new()local K={}setmetatable(K,C)K.data={}return K end function C.size(C)return#C.data end function C.push(K,C)K.data[K:size()+1]=C return K end function C.pop(C)local K=C:getBack()table.remove(C.data,C:size())return K end function C.getBack(C)if C:size()==0 then error("\115\116\097\099\107 \105\115 \101\109\112\116\121")end local K=C.data[C:size()]return K end function C.setBack(K,C)if K:size()==0 then error("\115\116\097\099\107 \105\115 \101\109\112\116\121")end K.data[K:size()]=C return K end return C
local Stack = {}
Stack.__index = Stack

function Stack.new()
	local self = {}
	setmetatable(self, Stack)
	self.data = {}
	return self
end

function Stack:size()
	return #self.data
end

function Stack:push(obj)
	self.data[self:size()+1] = obj
	return self
end

function Stack:pop()
	local result = self:getBack()
	table.remove(self.data,self:size())
	return result
end

function Stack:getBack()
	if self:size() == 0 then error("stack is empty") end
	local result = self.data[self:size()]
	return result
end

function Stack:setBack(obj)
	if self:size() == 0 then error("stack is empty") end
	self.data[self:size()] = obj
	return self
end

return Stack