@@ -0,0 +1,2092 @@
+/*%0A * Copyright 2017 haeun kim%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage algorithm.boj;%0A%0Aimport java.io.*;%0A%0A/**%0A * Created by haeun on 2017-10-06%0A * Site       : https://www.acmicpc.net/problem/10828%0A */%0A%0Apublic class Boj10828 %7B%0A    String%5B%5D items = new String%5B10000%5D;%0A%0A    int top = -1;%0A%0A    public void push(String item) %7B%0A        items%5B++top%5D = item;%0A    %7D%0A%0A    public String pop() %7B%0A        if (empty()==1)%7B%0A            return %22%22+ -1;%0A        %7D%0A        return items%5Btop--%5D;%0A    %7D%0A%0A    public String peek() %7B%0A        if(empty()==1)%7B%0A            return %22%22+ -1;%0A        %7D%0A        return items%5Btop%5D;%0A    %7D%0A%0A    public int size() %7B%0A        return top+1;%0A    %7D%0A%0A    public int empty() %7B%0A        if(top == -1)%7B%0A            return  1;%0A        %7Delse%7B%0A            return  0;%0A        %7D%0A    %7D%0A    public static void main(String%5B%5D args) throws IOException %7B%0A        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));%0A        int n = Integer.parseInt(br.readLine());%0A        Boj10828 obj = new Boj10828();%0A        for(int i=0; i%3Cn; i++)%7B%0A            String%5B%5D comm = br.readLine().split(%22 %22);%0A            if(comm%5B0%5D.equals(%22push%22))%7B%0A                obj.push(comm%5B1%5D);%0A            %7Delse if(comm%5B0%5D.equals(%22pop%22))%7B%0A                System.out.println(obj.pop());%0A            %7Delse if(comm%5B0%5D.equals(%22size%22))%7B%0A                System.out.println(obj.size());%0A            %7Delse if(comm%5B0%5D.equals(%22empty%22))%7B%0A                System.out.println(obj.empty());%0A            %7Delse%7B%0A                System.out.println(obj.peek());%0A            %7D%0A        %7D%0A    %7D%0A%0A%7D%0A

Solve No.10828 from Baekjoon Online Judge