public class LinkedList2
   {
   	
      public StringNode head;
   
       public LinkedList2(int length)
      {
         head = null;
      		
         for (int i = 0; i < length; i ++)
            insert(Integer.toString(i));
      	
      }

   
       public void insert(String n)
      {
         StringNode cur = new StringNode(n);
      
         cur.next = head;
      
         head = cur;
      }
   
   //Delete the node at the zero-based index.
       public void delete(int index)
      {
         int cur;
         StringNode curnode = head;
      
         for (cur = index; cur > 1; cur --) 
            curnode = curnode.next;
      	
         if (curnode == head)
            head = head.next;
         else
            curnode.next = curnode.next.next;
      }
   
       public String getVal(int index)
      {
         int cur;
         StringNode curnode = head;
      
         for (cur = index; cur > 0; cur --) 
            curnode = curnode.next;
      	
      //curnode should point to the node whose value we want.
         return curnode.getVal();
      }
   
       public void print()
      {
         System.out.println();
      
         head.print();
      }
   
   }