I have two lines with me:
s1="MICROSOFT" s2="APPLESOFT"
I need to compare the rows and remove the duplicated part (always towards the end) from the second row. Therefore, I should get "MICROSOFT" and "APPLE" as the output.
I compared the character of a string by character.
String s1 = "MICROSOFT"; String s2 = "APPLESOFT"; for(int j=0; j<s1.length(); j++) { char c1 = s1.charAt(j); char c2 = s2.charAt(j); if(c1==c2) System.out.println("Match found!!!"); else System.out.println("No match found!"); }
It should check the lines and if two lines have the same characters to the end of the line, then I need to remove this redundant part, SOFT in this case, from the second line. But I canβt figure out how to get out of here.
There may be more duplicates ... but we only need to remove those that are constantly identical. if I have APPWWSOFT and APPLESOFT, I have to get APPLE again in the second line, since we got a non-WW LE between
Can you guys help me here?
Snow leopard
source share