标签:package ring test log port for out har can
package Campus; import java.util.Scanner; public class Test_T1 { public static void main(String[] args) { StringBuffer s=joint(); System.out.println(s); } public static StringBuffer joint(){ Scanner cin = new Scanner(System.in); String str = cin.next(); char[] a = str.toCharArray(); int count, len = a.length; for(int i = 0; i < len - 1; i++){ count = 0; for(int j = i+1; j < len; j++){ if (a[j] != 0 && a[j] == a[i]){ count = count + 1; a[j] = 0; } } if (count == 0 || count > 1) a[i] = 0; } StringBuffer str1 = new StringBuffer(); for(int i = 0; i < len; i++){ if (a[i] != 0) str1.append(a[i]); } return str1; } }
标签:package ring test log port for out har can
原文地址:http://www.cnblogs.com/smuxiaolei/p/7816233.html