How to use push button to input value

The problem for me is i want to get input from the push button
like if button is pressed ( < 0.6 sec) means i want to input ' . ' inside and an array
and if the button is pressed ( > 0.6 sec) means i want to input ' _ ' inside the array and want to check(inputArray[ ] == password[ ] ) with the already declared array.if it matches means door will open otherwise it won't.

so i only need a way to input the characters into the array using push button