robdijo
asked on
Java Programming Question
Given 2 strings, a and b, return the number of the positions where they
contain the same length 2 substring. So "xxcaazz" and "xxbaaz" yields 3,
since the "xx", "aa" and "az" substring appear in the same place in
strings.
stringMatch("xxcaazz","xxb aaz") -> 3
stringMatch("abc", "abc") -> 2
stringMatch("abc", "axc") -> 0
public int stringMatch(String a, String b)
{
write code???
}
contain the same length 2 substring. So "xxcaazz" and "xxbaaz" yields 3,
since the "xx", "aa" and "az" substring appear in the same place in
strings.
stringMatch("xxcaazz","xxb
stringMatch("abc", "abc") -> 2
stringMatch("abc", "axc") -> 0
public int stringMatch(String a, String b)
{
write code???
}
Post the code you've written and we'll help with it. We don't write classwork for people
ASKER
I do not know where to start. I have no code.
Break down the task into parts, starting with
a. obtain all length 2 substrings from the source string by iteration [and print them out]
(the part in brackets can be removed later)
a. obtain all length 2 substrings from the source string by iteration [and print them out]
(the part in brackets can be removed later)
Is this your class assignment ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
write the code in this sense - post it we will correct
>>write the code
No need - you did it for him. Homework done then...
No need - you did it for him. Homework done then...