import java.io.*;
import java.util.StringTokenizer;
class parsetest
{
public static void main(String[] args) throws Exception
{
String temp;
String prelink,
postlink,
hyperlink;
int templength=0,
prelinkstart=0,
prelinkend=0,
hyperlinkstart=0,
hyperlinkend=0,
postlinkstart=0,
postlinkend=0;
String outfilename = "temp.txt";
PrintWriter fout = null;
BufferedReader fin = null;
StringTokenizer st = null;
fin = new BufferedReader(new FileReader("www.cnn2.com.html"));
fout = new PrintWriter(new BufferedWriter(new FileWriter(outfilename)));
temp = fin.readLine();
templength = temp.length();
System.out.println("length of input: " + templength);
prelinkstart = 0;
prelinkend = temp.indexOf("<a href=");
System.out.println(prelinkend);
prelink = temp.substring(prelinkstart, prelinkend);
System.out.println(prelink);
hyperlinkstart = prelinkend;
hyperlinkend =
hyperlink = temp.indexOf(prelinkend, templength);
System.out.println(hyperlink);
/*
while( temp != null)
{
// if(
// fout.println(
System.out.println(temp);
temp = fin.readLine();
}
*/
fin.close();
fout.close();
}//end of main
}//end of class