You are viewing a single comment's thread. Return to all comments →
ruby:
gets.to_i.times do n = gets.strip.to_i s = gets.strip.chars c = s.group_by{|x| x} happy = true c.each{|k,v| happy = false if v.size < 2 and k != '_'} happy = false if !c['_'] and s.each_with_index.count{|x,i| i>0 and x != s[i-1]} > c.size puts happy ? 'YES' : 'NO' end
Seems like cookies are disabled on this browser, please enable them to open this website
Happy Ladybugs
You are viewing a single comment's thread. Return to all comments →
ruby: