Advertisement
Aadvert

Untitled

Feb 14th, 2012
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.37 KB | None | 0 0
  1. B=string
  2. b=B.sub
  3. C=B.len
  4. function r(s, S)
  5.  if s=="" then return S end
  6.  S=S or ""
  7.  return r(b(s,2),b(s,1,1)..S)
  8. end
  9. function p(s)
  10.  for i=1,C(s) do
  11.   if not(b(s,i,i) == " ") then W=W..b(s,i,i) else
  12.   F=F..r(W).." "
  13.   W=""
  14.   end
  15.   end
  16.   F=F..r(W).." "
  17. end
  18.  
  19. repeat
  20. F,W="",""
  21. print("String? (q=quit)")
  22. m=io.read()
  23. x=m=="q"and os.exit()
  24. p(m)
  25. print(F)
  26. until x
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement