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;
    }

}

  

相关文章:

  • 2021-11-29
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-27
  • 2022-12-23
  • 2021-08-21
  • 2021-11-27
  • 2021-10-17
  • 2022-12-23
  • 2022-01-07
相关资源
相似解决方案