Day 28: RegEx, Patterns, and Intro to Databases

  • + 1 comment
    N = gets.strip.to_i
    arr = []
    for a0 in (0..N-1)
        firstName,emailID = gets.strip.split(' ')
        arr << firstName if emailID.include?("@gmail.com") || emailID.include?("@gmail.edu")
    end
    puts arr.sort
    

    Solution is obv. not reg-ex, but in the event there are @gmail.edu emails, the adjusted code above would account for them as well.