Programming Questions

  • Newest
  • Popular Tags
  • Ask Question
  • Checking sequence of letters
    Hello everyone, Merry Christmas!!! Can someone help me with this question? It is working on sublime, but not on Coderbyte.
    def SimpleSymbols(str)
      extracted = str.gsub(/[^a-zA-Z]/,'').chars #extracted
      str.split('').each_with_index do |x,i|
        extracted.each do |y|
          if x == y #checking if they have + left and right
            return false if str[0].chr == x || str[str.length - 1].chr == x || str[i - 1].chr != "+" || str[i + 1].chr != "+"
      return extracted == extracted.sort 
    # keep this function call here 
    # to see how to enter arguments in Ruby scroll down   
    Thank you very much in advance!
    danywithruby posted this question on 1/5/16 | simple, symbols, ruby, letters
    Log in to write an answer.