Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save alejandrolechuga/ad58e8e3ad834ed0829b20ec6fab1b21 to your computer and use it in GitHub Desktop.
Save alejandrolechuga/ad58e8e3ad834ed0829b20ec6fab1b21 to your computer and use it in GitHub Desktop.
class Main {
public static void main(String[] args) {
Main.func("Hello world!");
}
public static void func(String str) {
String output = "";
for (int i = 0; i < str.length(); i++) {
char character = str.charAt(i);
if (output.indexOf(character) == -1){
output += character;
}
}
System.out.println(output);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment