The three rows of the qwerty keyboard are qwertyuiop
, asdfghjkl
and zxcvbnm
. Your task is to find the longest word that can be typed using only one row of the keyboard, from a given list of words.
Sample input 1
artist
home
gas
writer
geology
marine
twerp
Output
writer
(Of the given words, only gas
, writer
and twerp
can be written using a single row, and writer
is the longest)
The words may not be actual words (so don't assume the third row to be invalid). However, you can assume that there will always be exactly one answer (no more, no less).
Sample input 2
wrhuji
bxnzmmx
gllwssjjd
vnccbb
lrkjhgfdsa
tttttt
Output
bxnzmmx
Additional punctuation and whitespaces can be provided in input (as per language requirements). However, no extra output should be given. Input and output are in lower case. Shortest code wins.