java http://e-tutor.itsa.org.tw/e-Tutor/mod/programming/view.php?id=29581
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java http://e-tutor.itsa.org.tw/e-Tutor/mod/programming/view.php?id=29581相关的知识,希望对你有一定的参考价值。
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scn = new Scanner(System.in);
int n=Integer.parseInt(scn.nextLine()),j=0;
String s[]=new String[n],str="";
for(int i=0;i<n;i++){
s[i]=scn.nextLine();
}
str+=s[0];
for(int i=1;i<n;i++){
j=s[i].length();
while(true){
if(str.contains(s[i].substring(0, j))){
str+=s[i].substring(j, s[i].length());
break;
}
j--;
}
}
System.out.println(str);
}
}
以上是关于java http://e-tutor.itsa.org.tw/e-Tutor/mod/programming/view.php?id=29581的主要内容,如果未能解决你的问题,请参考以下文章