// 判斷輸入字串是否連續 import java.io.*; public class a03 { public static void main(String args[]) throws Exception { //程式進入點 String getbr; char out[]=new char[5]; int i,j,flag; char now;//放被取出來的那個字母 BufferedReader br= new BufferedReader(new InputStreamReader(System.in)); while (true) { for (i=0;i<=4;i=i+1) out[i]='0'; //先歸0才不會錯 do { System.out.print("請輸入字串:"); getbr = br.readLine(); if (getbr.equals("0")) //判斷結束 { System.out.println("結束!"); return; } } while (getbr.length()!=5); //取出字元陣列 for (i=0;i<5;i=i+1) //處理每個字元 { out[i]=getbr.charAt(i); } //用先排序 for (i=4;i>0;i=i-1) //處理每個字元 { for (j=0;j