SmartKeyboard Advanced

I have tried this problem many times now but I still can’t get the solution. Please provide me with the complete solution to this problem in java.

here: