title: While loop not reading in the last item
body: <p>I'm trying to read in a multi line string then split it then print it .. here is the string :</p>
  
  <pre><code>1T1b5T!1T2b1T1b2T!1T1b1T2b2T!1T3b1T1b1T!3T3b1T!1T3b1T1b1T!5T1*1T
  
  11X21b1X
  4X1b1X
  </code></pre>
  
  <p>When I split the string with <code>!</code> I get this without the last line string :</p>
  
  <pre><code>1T1b5T
  1T1b5T1T2b1T1b2T
  1T2b1T1b2T1T1b1T2b2T
  1T1b1T2b2T1T3b1T1b1T
  1T3b1T1b1T3T3b1T
  3T3b1T1T3b1T1b1T
  1T3b1T1b1T5T1*1T
  5T1*1T11X21b1X
  11X21b1X
  </code></pre>
  
  <p>Here is my code :</p>
  
  <pre><code>import java.io.BufferedInputStream;
  import java.util.Scanner;
  
  public class Main {
  
      public static void main(String args[]) {
          Scanner stdin = new Scanner(new BufferedInputStream(System.in));
          while (stdin.hasNext()) {
              for (String line : stdin.next().split("!")) {
                  System.out.println(line);
  
                  for (int i = 0; i &lt; line.length(); i++) {
                      System.out.print(line.charAt(i));
                  }
              }
          }
      }
  
  }
  </code></pre>
  
  <p><em>Where did I make the mistake, why is not reading in the last line</em>? After I read in all lines properly I should go trough each line if I encounter number I should print the next char the n times the number I just read, but that is long way ahead first I need help with this. Thank you</p>
  
  <p><strong>UPDATE :</strong></p>
  
  <p>Here is how the output should look like :</p>
  
  <pre><code>1T1b5T
  1T2b1T1b2T
  1T1b1T2b2T
  1T3b1T1b1T
  3T3b1T
  1T3b1T1b1T
  5T1*1T
  
  11X21b1X
  4X1b1X
  </code></pre>
  
  <p>Here is a solution in C(my friend solved it not me), but I'd stil wanted to do it in JAVA :</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main (void)
  {
      char row[134];
      for (;fgets (row,134,stdin)!=NULL;)
      {
          int i,j=0;
          for (i=0;row[i]!='\0';i++)
          {
              if (row[i]&lt;='9'&amp;&amp;row[i]&gt;='1')
                  j+=(row[i]-'0');
              else if ((row[i]&lt;='Z'&amp;&amp;row[i]&gt;='A')||row[i]=='*')
                  for (;j;j--)
                      printf ("%c",row[i]);
              else if (row[i]=='b')
                  for (;j;j--)
                      printf (" ");
              else if (row[i]=='!'||row[i]=='\n')
                  printf ("\n");
          }
      }
      return 0;
  } 
  </code></pre>