Walk Across a Keyboard
Python 2, 83 bytes
lambda s:re.findall('.*?'.join(s),'qwertyuioplkmnjhbvgfcxdsza'*len(s))[0]
import re
Try it online!
Walks the entire keyboard until the word is written.
Python 2, 274 bytes (optimal solution)
296 300 302 308 315 319 324 327 328 430 432 bytes
-4 bytes thanks to mypetlion
from networkx import*
i=input()
M,z='qwertyuiop asdfghjkl zxcvbnm'.center(55),i[:1]
G=from_edgelist([(M[e],M[e+h])for h in[-1,1,11,12,-11,-12]for e in range(44)if' '!=M[e]and' '!=M[e+h]])
for y,x in zip(i,i[1:]):z+=[shortest_path(G,y,x)[1:],list(G[y])[0]+y][x==y]
print z
Try it online!
This solution gives the shortest possible output. The keyboard is transformed into a graph used to find the shortest path to compute the output string:
puzzles --> poiuhbvcxzazxcvbhjklkiuytres
programming --> poiuytrtyuioijhgtresasdcvbnmkmkijnbg
code --> cvbhjioijhgfde
golf --> ghjiolkjhgf
yes --> ytres
hi --> hji
poll --> polpl
Japt -g
, 23 bytes
;D·ÎÔ+D·Årí)pUl)fUq".*?
Try it online!
Takes input as an array of capital letters. Very similar to the other answers otherwise.
Explanation:
; :Set D to the keyboard layout
D·Î :Get the first row of keys
Ô :Reversed
+ :Concat
D·Å :The other two rows
rí) :Interleaved
p :Repeat that string
Ul) : A number of times equal to the length of the input
f :Get the substrings that match
U : The input
q".*? : joined with ".*?"
:Implicitly output just once of the matches