/*****************************************************************
** DemoInfiniteLoop
**
** (c) Scott MacKenzie, 2000                             
******************************************************************/
import java.io.*;

public class DemoInfiniteLoop
{
   public static void main(String[] args) throws IOException
   {
      BufferedReader stdin =
         new BufferedReader(new InputStreamReader(System.in), 1);

      System.out.println("Enter lines of characters:\n" +
                         "(Line beginning with 'Q' quits)");
      while (true)
      {
         String s = stdin.readLine();
         if (s.length() > 0 && s.charAt(0) == 'Q')
            break;
         System.out.println(s);
      }
      System.out.println("Thank you");
   }
}

