diff --git a/src/Main.java b/src/Main.java index 930198c..f70f1de 100644 --- a/src/Main.java +++ b/src/Main.java @@ -1,15 +1,24 @@ +import java.util.HashSet; + //TIP To Run code, press or // click the icon in the gutter. public class Main { public static void main(String[] args) { //TIP Press with your caret at the highlighted text // to see how IntelliJ IDEA suggests fixing it. - System.out.printf("Hello and welcome!"); - - for (int i = 1; i <= 5; i++) { - //TIP Press to start debugging your code. We have set one breakpoint - // for you, but you can always add more by pressing . - System.out.println("i = " + i); + System.out.println("Hello and welcome!\n"); + System.out.println("Is 'test' unique: " + isUnique("test")); + System.out.println("is 'steak' unique: "+ isUnique("steak")); + } + public static boolean isUnique(String inputString) + { + HashSet testString = new HashSet(); //Maybe not hashSet? + for(int i = 0; i < inputString.length(); i++) + { + //still need to check format before add. + if (!(testString.add(inputString.charAt(i)))) + return false; } + return true; } } \ No newline at end of file