Skip to content

Instantly share code, notes, and snippets.

@lethe2211
Created October 26, 2014 10:09
Show Gist options
  • Save lethe2211/59f178d581a3d9ec1fb2 to your computer and use it in GitHub Desktop.
Save lethe2211/59f178d581a3d9ec1fb2 to your computer and use it in GitHub Desktop.
import java.util.HashMap;
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
String str = sc.next();
HashMap<String, Boolean> count = new HashMap<String, Boolean>();
Boolean flag = true;
for (int i = 0; i < str.length(); i++) {
String c = str.substring(i, i + 1);
if (count.containsKey(c)) {
flag = false;
} else {
count.put(c, true);
}
}
if (flag) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment