title: can not determinate index in array
body: <p>Strings are added to the array, to determine whether the list is ordered by increasing the length of the string. If not, print the index of the first element that violates such ordering.
  Everything works correctly if the strings in the array are different, for example, enter</p>
  
  <pre><code>113
  13476
  Neutral
  wa
  </code></pre>
  
  <p>Answer: index (wa) 3 output.</p>
  
  <p>but if it will be like this:</p>
  
  <pre><code>123
  12345
  123
  </code></pre>
  
  <p>Answer: index (123) - 0 but the correct answer is index 2</p>
  
  <pre><code>public class Solution {
  
      public static void main(String[] args) throws IOException {
  
               Scanner scan = new Scanner(System.in);
               ArrayList&lt;String&gt; list = new ArrayList&lt;&gt;();
          for (int i = 0; i &lt; 4; i++) {
              list.add(scan.nextLine());
          }
          int count = 0;
          for(int i = 0; i &lt; list.size(); i++){
              if(count+2 &gt; list.size()) {
                  break;
              }
              if(list.get(i+1).length() &lt;= list.get(i).length()){
                  System.out.println(list.indexOf(list.get(i+1)));
                            break;
              }
                         count = count + 1;
          }
       }
  }
  </code></pre>