swapPairs
that accepts
a String
as a parameter and returns that String
with each pair of adjacent letters reversed. If the String
has an odd number of letters, the last letter is unchanged. For example,
the call swapPairs("forget")
should
return "ofgrte"
and the call swapPairs("hello
there")
should return "ehll ohtree"
.