/*
//stack : 나중에 들어온 데이터가 가장 먼저 나가는 구조
#include <stdio.h>
#define SIZE 10
//int n;//변수 선언 <-> 상수
int stack[SIZE];
int top=-1; // top : 마지막으로 들어온 데이터가 있는 곳
void push(int data) //스택의 맨 위에 데이터 삽입
{
if(top==SIZE-1) return ;
stack[++top]=data;
}
int pop() //마지막에 들어온 데이터 제거
{
if(top==-1) return -1;
return stack[top--];
}
int main()
{
push(1);
push(2);
push(8);
printf("%d\n",pop());
printf("%d\n",pop());
}
*/
/*
#include <stdio.h>
#define SIZE 200
//int n;//변수 선언 <-> 상수
int stack[SIZE];
int top=-1; // top : 마지막으로 들어온 데이터가 있는 곳
void push(int data) //스택의 맨 위에 데이터 삽입
{
if(top==SIZE-1)
return ;
stack[++top]=data;
}
int pop() //마지막에 들어온 데이터 제거
{
if(top==-1)
return -1;
return stack[top--];
}
int main()
{
int N,c,i,b=6,sum=0;
char str[50];
scanf("%d ",&N);
for(i=1; i<=N; i++)
{
gets(str);
if(str[1]=='u')
{
b=6;sum=0;
while(str[b]!=' ')
{
sum=sum*10+str[b]-'0';
b++;
}
push( sum );
}
else if(str[0]=='t')
{
if(top==-1)
{
printf("-1");
}
else
{
printf("%d",stack[top]);
}
printf("\n");
}
else if(str[0]=='p' || str[1]=='o')
{
pop();
}
else if(str[0]=='s')
{
printf("%d",top+1);
printf("\n");
}
else if(str[0]=='e')
{
if(top+1>0)
{
printf("false");
}
else
{
printf("true");
}
printf("\n");
}
}
}
*/