i
and j
to 0.result
.i
is less than the length of word1
or j
is less than the length of word2
:
a. If i
is less than the length of word1
, append word1[i]
to result
and increment i
.
b. If j
is less than the length of word2
, append word2[j]
to result
and increment j
.result
string.