一波三折但好在跟着思路走下来了 还是老样子,存储在stringbuilder里面

import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        while(scan.hasNext()){
            String str = scan.nextLine();
            StringBuilder strb = new StringBuilder();         
            int[] nums = new int[129];
            int count = 0;
            for(char c : str.toCharArray()){
                nums[(int)c]++;
            }
            for(int i = 0; i<nums.length; i++){
                if(nums[i] == 1){
                    strb.append((char)i);
                }
            }
            if(strb.length() == 0){
                System.out.println("-1");
            }
            else{
                for(char c : str.toCharArray()){
                    if(strb.toString().contains(String.valueOf(c))){
                        System.out.println(c);
                        break;
                    }
                }
            }
        }
        scan.close();
    }
}