s = gets.chomp ans = 0 while s != '' if s =~ /…+/ ans = [ans,$&.length].max s = $'.to_s else s = '' end end if ans == 1000 p -1 else p ans end