Last active
February 14, 2017 13:30
-
-
Save tst2005/fd3a5f7446509f7802ba87ed6c41b41d to your computer and use it in GitHub Desktop.
word-rev.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for word,space in io.stdin:read("*l"):gmatch("(%S+)(%s*)") do | |
io.stdout:write( word:reverse()..space ) | |
end | |
io.stdout:write("\n") | |
--[[-- | |
-- $ echo 123 456-789 | lua word-rev.lua | |
-- 321 987-654 | |
--]]-- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment