title: `input_data': undefined method `chomp' for nil:NilClass (NoMethodError)
body: <p>Hello guys I have the following problem:</p>
  
  <p><strong>INPUT</strong>:<br>
  2<br/>
  ababaa<br/>
  aa<br/></p>
  
  <p><strong>OUTPUT</strong>:<br>
  11<br/>
  3<br/></p>
  
  <p><strong>Explanation:</strong><br>
  For the first case, the suffixes of the string are "ababaa", "babaa", "abaa", "baa", "aa" and "a". The similarities of each of these strings with the string "ababaa" are 6,0,3,0,1,1 respectively. Thus the answer is 6 + 0 + 3 + 0 + 1 + 1 = 11.</p>
  
  <p>For the second case, the answer is 2 + 1 = 3.</p>
  
  <p>This part works , but some of the test that my code should pass don't.</p>
  
  <p>Here is my code</p>
  
  <pre><code>def input_data
  #STDIN.flush
  tries = gets.chomp
  end
  
  strings=[];
  tries = input_data until (tries =~ /^[1-9]$/)
  tries = tries.to_i
  strings &lt;&lt; input_data until (strings.count == tries)
  
  strings.map do |x|
  values = 0
  current = x.chars.to_a
  (0..x.length-1).map do |possition| 
      current_suffix = x[possition..-1].chars.to_a
      (0..current_suffix.length-1).map do |number|
          if (current_suffix[0] != current[0])
              break
          end
  
          if ( current_suffix[number] == current[number] )
              values = values+1
          end
      end 
    end
  
    if (values != 0)
      puts values
    end
  end
  </code></pre>
  
  <p>Any suggestions how to fix it ??</p>