Answer the question
In order to leave comments, you need to log in
How to add two lines correctly?
Good day.
There is a simple task: to add two strings, eliminating the repeated characters 'at the junction' of these strings. So, from 'abc' and 'bcd' we get the string 'abcd'.
This resulted in the following cycle:
public String conCat(String a, String b) {
int len = a.length();
String c = "";
for (int i = 0; i < b.length(); i++);
if (a.charAt(len - 1 - i).equals(b.charAt(i)))
c += "";
else
c += b.charAt(i);
return a + c;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question