package com.atguigu.java1; /** * @author limou * @create 2022-05-04 18:42 */ public class chazhao { public static void main(String[] args) { String s2 = "abcwerthelloyulodef"; String s3 = "cvhellobnm"; chazhao c = new chazhao(); System.out.println(c.chaozhaochuan(s2, s3)); } public String chaozhaochuan(String s, String s1){ String max = s.length()>s1.length()?s:s1; String min = s.length()= 0;i--){ for(int k = 0,j = i;j <= min.length() - 1;k++,j++){ if(max.contains(min.substring(k, j))){ return min.substring(k, j); } } } return null; } }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)