abc = gets length = abc.length/2 bbb = abc.scan(/.{1,#{length}}/) if bbb[0] == bbb[1] puts "YES" else puts "NO" end