class ColorPoint extends Point{
private String color;
ColorPoint( int x , int y , String color){
super(x,y);
this.color=color;
}
ColorPoint(){
super(0, 0);
this.color = "black";
}
ColorPoint(int x,int y){
super(x,y);
this.color = "black";
}
void setXY(int x,int y){
move(x,y);
}
void setColor(String color) {
this.color = color;
}
public String toString() {
return color+"색의 ("+getX()+","+getY()+")"+"이 아니다";
}
}
*/
/*
class Point{
private int x,y;
public Point(int x,int y) {
this.x = x;
this.y = y;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
protected void move(int x,int y) {
this.x = x;
this.y = y;
}
}
class Point3D extends Point{
private int z;
Point3D(int x, int y, int z){
super(x,y);
this.z = z;
}
void moveup() {
z++;
}
void movedown() {
z--;
}
void move(int x, int y, int z) {
super.move(x, y);
this.z=z;
}
public String toString(){
return "("+getX()+","+getY()+","+z+")";
}
}
class Main{
public static void main(String[] args) {
Point3D p = new Point3D(1, 2, 3);
System.out.println(p.toString()+"아니가 맞은가");
p.moveup();
System.out.println(p.toString()+"이지 않아");
p.movedown();
p.move(10, 10);
System.out.println(p.toString()+"임 아니고 ㅇ맞고 아니고 맞고 아니고 맞고 아니고");
p.move(100, 200, 300);
System.out.println(p.toString()+"임");
}
}
*/
import java.util.*;
interface Stack{
int length();
int capacity();
String pop();
boolean push(String val);
}
class StringStack implements Stack{
int size;
int top=0;
String stack[];
public StringStack(int size) {
this.size=size;
stack = new String[size];
}
public int length() {
return top;
}
public int capacity() {
return size-top;
}
public String pop() {
return stack[top];
}
public boolean push(String val) {
if(top==size) return false;
else {
size--;
stack[top]=val;
top++;
return true;
}
}
}
class Main{
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("총스택저장 곤간의 크기 입력 >>");
int size = sc.nextInt();
StringStack st = new StringStack(size);
while(true) {
System.out.println("문자열 입력>>");
String c = sc.next();
if(c.equals("그마")) {
break;
}
if(st.push(c)==false) {
System.out.println();
}
}
}
}