suppose we have String str = "Hello-Hello1"; How do we split it and compare it to see if it is equal or not?
This is what I wrote, but it does not give me the result.
public static void main(String[] args) {
        String str = "Hello-Hello1";
        
        String [] a = str.split("-");
        
        for(int i=0; i<a.length; i++) {
            System.out.print(a[i]+ " ");
        }
        for(int first =0; first<a.length; first++) {
            for(int second =first+1; second<a.length; second ++) {
                if(a[first].equals(a[second])){
                    System.out.println(a[first]);
                }
            }
        }
         
    }
 
    