㈠ java实现,从a,b,c,d,e,f,g,h,i...aa,ab,ac,...az,ba,bb,.,bz,..到zz,输出指定数目比如输出前87个
String az = "abcdefghijklmnopqrstuvwxyz";
ArrayList<String> al = new ArrayList<String>();
for(int j=0; j<az.length(); j++) al.add(az.substring(j,j+1));
for(int i=0; i<az.length(); i++){
for(int j=0; j<az.length(); j++) al.add(az.substring(i,i+1)+az.substring(j,j+1));
}
for(int j=0; j<87; j++) System.out.println(al.get(j));
运行结果:
a b c d e f g h i j k l m n o p q r s t u v w x y z aa ab ac ad ae af ag ah ai aj ak al am an ao ap aq ar as at au av aw ax ay az ba bb bc bd be bf bg bh bi bj bk bl bm bn bo bp bq br bs bt bu bv bw bx by bz ca cb cc cd ce cf cg ch ci