defneighborsstrnum=str.to_ires=casenumwhen0[num+1]when9999999999[num-1]when-Float::INFINITY..0,9999999999..Float::INFINITYraise'Not a phone number'else[num-1,num+1]endres.map(&:to_s)end
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Simple ruby solution(with edge cases):