import java.io.*;
import java.net.*;
import java.util.*;

class getcontent
{       private static final String news_source 
           = "http://catalog.com/dddu/wt/headlines.txt";
        public static void main (String[] args)
        {       try
                {       URL url =  new URL (news_source) ;
                        BufferedReader br = new BufferedReader 
                           (new  InputStreamReader
                              (url.openConnection().
                                 getInputStream ()));
     
                        String line;
                        if ( (line = br.readLine ()) == null)
                           { br.close(); return; }
                        System.out.println("<h3>Headlines from " 
                           + line + "</h3><ul>");
                        while ((line = br.readLine ()) != null)
                        {       int i;
                                if( (i = line.indexOf ("|")) > 0)
                                {
                                   System.out.println("<li><a href=\""
                                      + line.substring (i+2) + "\">");
                                   System.out.println( line.substring 
                                      (0,i-1)
                                         + "</a>");
                                }
                        }
                        br.close (); System.out.println("</ul>");
                } catch(Exception e){ e.printStackTrace(); }
        }
}