Question: Check this answer do the problem by hand. What should be the correct output for input abcdkfjsksioehgjfhsdjfhksdfhuwabcabcajfieowj? Enter your answer with the printed strings separated
Check this answer do the problem by hand. What should be the correct output for input abcdkfjsksioehgjfhsdjfhksdfhuwabcabcajfieowj? Enter your answer with the printed strings separated by commas, str1, str2. For example, if the output were bcq, bcd, and bcu, you would write: bcq, bcd, bcu public void findAbc(String input){ int index = input.indexOf("abc"); while (true){ if (index == -1 || index >= input.length() - 3){ break; } String found = input.substring(index+1, index+4); System.out.println(found); index = input.indexOf("abc",index+4); } } public void test(){ //findAbc("abcd"); findAbc("abcdabc"); }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
