#include <iostream>
#include <vector>
#include <sstream>
using namespace std; int n;
string c[100];
string res;
int fir=1;
int ok=0;
string line;
int main()
{
cin>>n;
getline(cin,line);
for(int i=0;i<n;i++){
ok=0;
getline(cin,line);
c[i]=line;
int p=res.size()-1,q=c[i].size()-1;
while(p>=0&&q>=0){
if(res[p]==c[i][q]){
p--;q--;
}else{
break;
}
}
if(fir){
res=c[i];
fir=0;
}else{
res=c[i].substr(q+1);
}
}
if(res.size()==0) cout<<"nai"<<endl;
else cout<<res;
return 0;
}

  

PAT1077. Kuchiguse (20)的更多相关文章

  1. PAT1077: Kuchiguse

    1077. Kuchiguse (20) 时间限制 100 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 HOU, Qiming The Japan ...

  2. 1077. Kuchiguse (20)【字符串处理】——PAT (Advanced Level) Practise

    题目信息 1077. Kuchiguse (20) 时间限制100 ms 内存限制65536 kB 代码长度限制16000 B The Japanese language is notorious f ...

  3. PAT 甲级 1077 Kuchiguse (20 分)(简单,找最大相同后缀)

    1077 Kuchiguse (20 分)   The Japanese language is notorious for its sentence ending particles. Person ...

  4. 1077. Kuchiguse (20)

    The Japanese language is notorious for its sentence ending particles. Personal preference of such pa ...

  5. PAT Advanced 1077 Kuchiguse (20 分)

    The Japanese language is notorious for its sentence ending particles. Personal preference of such pa ...

  6. PAT甲级——1077.Kuchiguse(20分)

    The Japanese language is notorious for its sentence ending particles. Personal preference of such pa ...

  7. PAT (Advanced Level) 1077. Kuchiguse (20)

    最长公共后缀.暴力. #include<cstdio> #include<cstring> #include<cmath> #include<vector&g ...

  8. PAT甲题题解-1077. Kuchiguse (20)-找相同后缀

    #include <iostream> #include <cstdio> #include <algorithm> #include <string.h&g ...

  9. PAT A1077 Kuchiguse (20)

    晴神书中AC代码 #include <cstdio> #include <cstring> #include <iostream> using namespace ...

随机推荐

  1. centos7的nfs配置

    author : headsen chen date : 2018-04-12  09:40:14  一,服务端安装和配置: 环境准备: systemctl stop firewalld system ...

  2. mac同时安装多个jdk

    DK8 GA之后,小伙伴们喜大普奔,纷纷跃跃欲试,想体验一下Java8的Lambda等新特性,可是目前Java企业级应用的主打版本还是JDK6, JDK7.因此,我需要在我的电脑上同时有JDK8,JD ...

  3. centos7安装tomcat7

    1.去官网下载指定的安装包http://tomcat.apache.org/download-70.cgi 2.把下载下来的安装包放在/opt下 3.使用命令解压下载的文件tar -zxvf apac ...

  4. shell正则式解析身份证和手机号

    cat test2.html | sed -e 's/\(^\|[^0-9]\)\(13[0-9][0-9]\{8\}\|14[579][0-9]\{8\}\|15[0-3,5-9][0-9]\{8\ ...

  5. Django-admin列表展示上传图片

    1.在models.py文件中创建表ImageField类型字段 class user(models.Model): img = models.ImageField(upload_to='static ...

  6. HDU1712:ACboy needs your help(分组背包)

    题目:http://acm.hdu.edu.cn/showproblem.php?pid=1712 解释看这里:http://www.cnblogs.com/zhangmingcheng/p/3940 ...

  7. [设计模式]访问者 Visitor 模式

    访问者模式是对象的行为模式. 访问者模式的目的是封装一些施加于某种数据结构元素之上的操作.一旦这些操作需要修改的话,接受这个操作的数据结构则可以保持不变.

  8. 快速入门Python中文件读写IO是如何来操作外部数据的?

    读写文件是最常见的IO操作.Python内置了读写文件的函数,用法和C是兼容的. 读写文件前,我们先必须了解一下,在磁盘上读写文件的功能都是由操作系统提供的,现代操作系统不允许普通的程序直接操作磁盘, ...

  9. (转) latch 入门

    原链接:http://www.itpub.net/thread-1424719-1-1.html (入门1)一直想点文章关于Latch的,又一直没写,一是因为懒,二是一直觉得现在关于Latch的书那么 ...

  10. 关于 sql server 基本使用的建议

    1.   把现有的表插入到新表,(表不能存在),为表备份. --  select  *  into  NewTable   from  OldTable   (NewTable 在select 查询的 ...