Is the problem in the code or in the OLED screen?

I get your explanation. A couple of things to note

  1. the OLED display takes up a LOT of memory and it looks like you are using an UNO so you may be running out of memory.

  2. You calculations on the input reduce to simply the index into the original array. a..z = 0..25 and '0'..'9' go to 26..35. That is why my code just stores the index along with the char when you press the KEY.

  3. your two indices into your matrix are just counting from each end of your array.

  4. What comes out on the Serial Monitor? Adding some debug statements during the calculation may help.

  5. what part of the code I provided don't you understand? I simply renamed a few variables, moved a few global variables to local versions and put some code inside functions. Nothing too fancy.