吉比特笔试-题解-第一题
package 面试练习; import java.util.*; //hiHI //输出hi public class Main { public static void main(String[] args) { Scanner scanner=new Scanner(System.in); String s=scanner.nextLine(); char[] a=s.toCharArray(); Set<Character>set=new HashSet<>(); StringBuilder builder=new StringBuilder(); for (int i = 0; i <a.length ; i++) { boolean flag=false; for (char key:set) { if(a[i]==Character.toUpperCase(key)||a[i]==Character.toLowerCase(key)){ flag=true; } } if(!flag){ //此处保存字符串的顺序,因为set是无序的 builder.append(a[i]); set.add(a[i]); } } System.out.println(builder.toString()); } }
#吉比特笔试##LINE##笔试题目##春招#