Skip to content

Instantly share code, notes, and snippets.

Revisions

  1. alejandrolechuga created this gist May 17, 2019.
    16 changes: 16 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    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);
    }
    }