Weird output

What MorgnS said.

      for(unsigned int a = 0; a < sizeof(keys); a = a+1) {
        Serial.print(keys[a]);
      }

Tis prints every element of the buffer, including the characters you have not filled in yet.