# 이전에 작성한 Node, Doubly Linked List 클래스를 활용.
fromdobulyimportNodefromdobulyimportDoublyLinkedListclassLinkedListStack:def__init__(self):self.data=DoublyLinkedList()defsize(self):returnself.data.getLength()defisEmpty(self):returnself.size()==0defpush(self,item):node=Node(item)self.data.insertAt(self.size()+1,node)defpop(self):self.data.popAt(self.size())defpeek(self):returnself.data.getAt(self.size()).data