Now also posted here.
Type: Posts; User: GregBrannon
Now also posted here.
Can you see that the correct answer is there, but the output is "wrong"? And the output isn't really wrong, but it includes test code that you used to improve your program. I think you can remove...
And what does "not working perfectly" mean? Show a sample run as you've done before and what is incorrect with it.
If the statement:
if (words[j + 1].equals(word))
is causing the error (as it was in your first post), then ensure that j + 1 does not exceed the array's number of elements - 1. How could you...
Don't create a new Scanner object each time you need to get input. The object scan can be used both times.
I see that this line will most likely cause an error each time it is run:
if (...