title: Stack Pop loop does not pop all elements
body: <p>I am practicing Try-Catch, Exception Handling, and Stacks and Queues, so although the code may be impractical, it is useful for my practice.</p>
  
  <pre><code>public class Practice {
  public static void main(String args[]){
      Stack&lt;String&gt; sStack = new Stack&lt;String&gt;();
      Queue&lt;String&gt; sQueue = new LinkedList&lt;String&gt;();
      Scanner input = new Scanner(System.in);
      String inString = " ";
  
      boolean done = false;
      do{
          try{
              while(!inString.equals("")){
                  System.out.println("Enter a string: ");
                  inString = input.nextLine().toString();
                  addS(sStack,inString);
              }
              done = true;
          }catch(Exception e){}
          sStack.pop();
          for(int i = 0; i&lt;sStack.size()+1;i++){
              remS(sStack);
          }
  
      }while(done == false);
  }
  </code></pre>
  
  <p>The code is intended to loop through and populate an empty stack based on user input, and then loop through the stack and remove each element while giving a prompt. The first set I input is:</p>
  
  <p>[art, bat, cat, dock, eye, father]</p>
  
  <p>the second set is:</p>
  
  <p>[art, bat, cat, dock, eye, father, kid]</p>
  
  <p>I noticed that no matter how many elements I input it will only remove up to 4 elements. I would like your help in figuring out why. I tried playing around with the loop's bounds as you can see, but to no avail. No matter where I start or bound, it will always end up popping only 4 elements max.</p>
  
  <p>The addS and remS functions I provide below</p>
  
  <pre><code>public static void addS(Stack t, String s){
      t.push(s);
      System.out.printf("%s was added to the stack %s", s, t);
      System.out.println();
  }
  
  public static void remS(Stack t){
  
      System.out.printf("\n%s has been popped.",t);
      t.pop();
      System.out.printf("The current elements are now: ");
      System.out.print(t);
      System.out.printf("The next element to be popped is %s", t.peek());
  }
  </code></pre>