g | x | w | all
Bytes Lang Time Link
068Juby221011T165727ZJordan
016Vyxal221011T174607ZnaffetS
023Japt g181207T012130ZKamil Dr
03805AB1E220126T211819ZMakonede
03105AB1E181207T110630ZKevin Cr
274Python 2 + NetworkX181207T153519Zmdahmoun
048Charcoal181207T133457ZNeil
070JavaScript ES6181206T234545ZArnauld
083Python 2181206T213325ZTFeld

J-uby, 68 bytes

Again lost a few bytes by having to call Regexp.new with a string instead of using a Regexp literal with interpolation. Same technique as TField et al.

-[:+@|:*&"qazsxdcfvgbhnjmklpoiuytrew",~:join&".*?"|:new&Regexp]|+:[]

Attempt This Online!

-[
  :+@ | :* & "qazsxdcfvgbhnjmklpoiuytrew",  # Repeat string times size of input
  ~:join & ".*?" | :new&Regexp              # Also make a Regexp by joining input with ".*?"
] |                                         # then
+:[]                                        # call :[] with the two values, i.e. repeated_string[regexp]

Vyxal, 16 bytes

Lk•÷Y$Ṙp*?‛€?jẎh

Try it Online!

Lk•÷Y$Ṙp*?‛€?jẎh
 k•              # List of rows on the keyboard: ["qwertyuiop", "asdfghjkl", "zxcvbnm"]
   ÷             # Push each item onto the stack
    Y            # Interleave the top two: "azsxdcfvgbhnjmkl"
     $           # Swap so "qwertyuiop" is on top
      Ṙ          # Reverse it
       p         # Prepend it to the other string
L       *        # Repeat it input-length number of times
         ?‛€?j   # Join each character in the input by ".*?"
              Ẏh # Get the first regex match

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 one of the matches

05AB1E, 51 39 38 bytes

-1 thanks to Kevin Cruijssen.

gžV`.ιJsRì×s….*?ý’R޽™«.‡Ð~r/ÿ/,"ÿ"’.E

Try it online! Takes input as a list of lowercase letters and outputs as a singleton list.

This answer exists to prove Kevin Cruijssen wrong; you can use regex in 05AB1E.

05AB1E, 43 33 31 bytes

ü2εUžV`.ιJsRìD«Œ.ΔнÅ?XyθÅ¿}¨}JIθ«

Not the right language for this challenge, since it cannot use regex like the other answers did.. EDIT: proven wrong by @Makonede's 05AB1E answer using the Elixir eval builtin .E.

Try it online or verify all test cases.

Explanation:

ü2             # Split the input into overlapping pairs
               #  i.e. "poll" → ["po","ol","ll"]
  ε            # Map each to:
   U           #  Pop and store the current pair in variable `X`
   žV          #  Push ["qwertyuiop","asdfghjkl","zxcvbnm"]
     `         #  Pop and push all three separated to the stack
      .ι       #  Interweave the top two with each other
        J      #  Join the list of characters to a single string
               #   → "azsxdcfvgbhnjmkl"
         s     #  Swap so "qwertyuiop" is at the top
          R    #  Reverse it to "poiuytrewq"
           ì   #  Prepend it in front of the earlier string
               #   → "poiuytrewqazsxdcfvgbhnjmkl"
            D« #  Duplicate it, and append it to itself
               #   → "poiuytrewqazsxdcfvgbhnjmklpoiuytrewqazsxdcfvgbhnjmkl"
   Œ           #  Get all substrings of this strings
    .Δ         #  Find the first substring which is truthy for:
      Á        #   Rotate the current string once towards the right
       2£      #   Only leave the first 2 letters
         R     #   Reverse it
          XQ   #   Check if it's equal to pair `X`
     }¨        #  After the find_first, remove the last character
  }            # Close the map
   J           # Join everything together
    Iθ«        # Append the last character of the input
               # (after which the result is output implicitly)

Python 2 + NetworkX, 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

Charcoal, 48 bytes

≔”&⌈″⌊5EWXVNa…-εW¶ζR”η≔⌕η§θ⁰ζFθF⊕﹪⁻⌕ηιζ²⁶«§ηζ≦⊕ζ

Try it online! Link is to verbose version of code. Explanation:

≔”&⌈″⌊5EWXVNa…-εW¶ζR”η

Get the string qwertyuioplkmjnhbgvfcdxsza.

≔⌕η§θ⁰ζ

Find the position of the first character of the word. This index is normally one past the character just reached, but this value fakes out the first iteration of the loop to print the first character of the word.

Fθ

Loop over each character.

F⊕﹪⁻⌕ηιζ²⁶«

Compute how many characters to print to include the next character of the word and loop that many times.

§ηζ≦⊕ζ

Print the next character cyclically indexed and increment the index.

JavaScript (ES6), 70 bytes

Same strategy as TFeld.

s=>'qazsxdcfvgbhnjmklpoiuytrew'.repeat(s.length).match(s.join`.*?`)[0]

Try it online!

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.