brewersfan1976

reduce_string.rb

Feb 28th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.28 KB | None | 0 0
  1. def reduceString(inputString)
  2.     x = 0
  3.    
  4.     while (true)
  5.           if inputString[0] != inputString[inputString.length - 1] or inputString == "" then
  6.              return inputString
  7.           end
  8.              
  9.           inputString = inputString[1...-1]
  10.     end
  11. end
Advertisement
Add Comment
Please, Sign In to add comment