#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, const char * argv[]) {
char strs[20][100];//新建数组,用来存放输入的字符串
int line = 0;
int endflag = 0;
while(!endflag){
gets(strs[line]); //循环读取输入的字符串
if(strcmp(strs[line],"end")!=0){//输入字符串为“end”,则跳出循环
line++; //从0行开始,每行存储一个字符串
}
else
endflag = 1;
}
for(int i=line-1; i>=0; i--){ //从倒数第二行开始逐行输出
printf("%s\n",strs[i]);
}
return 0;
}