Skip to content

Instantly share code, notes, and snippets.

@thinkphp
Created April 19, 2026 17:49
Show Gist options
  • Select an option

  • Save thinkphp/fd9bf5bbffd7d3d3b9718221b3b630eb to your computer and use it in GitHub Desktop.

Select an option

Save thinkphp/fd9bf5bbffd7d3d3b9718221b3b630eb to your computer and use it in GitHub Desktop.
Codeforces Boy or Girl cu SET
public class Main {
//Maarriaa
public static int CountDistinctChars(String s) {
Set<Character> set = new HashSet<>();//caracterele vor fi distincte
for(char c : s.toCharArray()) {//m, a,
set.add( c );//m//a//
}
return set.size();//mari
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String user = scanner.next();
boolean isGirl = countDistinctChars(user) % 2 == 0;
System.out.println(isGirl ? "CHAT WITH HER!":"IGNORE HIM!")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment