import java.util.Scanner;
public class TestScanner{

  /* help:
    http://stackoverflow.com/questions/11546146/how-to-change-r-n-to-line-separator-in-java
    */

   public static void main (String [] args) {
      read();
   }

   public static void read () {
      Scanner sc = new Scanner(System.in);
      int i = 0;
      String line = "";
               System.out.println("give lines");

      while (sc.hasNextLine() && ! line.equals("quit") && i < 12){
         i++;
         line = sc.nextLine();
         //sc.skip("[\r\n]+");
         //sc.skip("[a]+");
      
                  /* DEBUGGING */
            /* Tests for Windows 7 */
         System.out.println(i + " Line: " + line);
            
         String test = "";
         test = line.replaceAll("    ", "<REPLACE>");
         // input.replaceAll("\\\\r\\\\n",System.getProperty("line.separator"))
         // input.replaceAll("(\\\\r)?\\\\n", System.getProperty("line.separator"));
         // input = systemIn.nextLine().replaceAll("\\\\r", "\r").replaceAll("\\\\n", "\n");
         // nextLine() strips of the newline at the end. If you want to add a line separator you can do
         // input = systemIn.nextLine() + System.getProperty("line.separator");
         
         System.out.println("Length line " + line.length());
         
         int len = test.length();
         System.out.println("Length test " + len);
         len = Math.min(test.length(), 600);
         System.out.println(test.substring(0,len));
         System.out.println("Test String created, equal? " + 
                  test.equals(line));
      
      
      
      }
   }

}//END class