import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class URLTest {
/**
* @param args
* @throws URISyntaxException
*/
public static void main(String[] args) throws Exception {
URL url = new URL("/");
InputStreamReader reader = new InputStreamReader(url.openStream());
BufferedReader br = new BufferedReader(reader);
String s = null;
while((s=br.readLine())!=null){
s = GetContent(s);
if(s!=null){
System.out.println(s);
}
}
br.close();
reader.close();
}
public static String GetContent(String html) {
//String html = "<ul><li>1.hehe</li><li>2.hi</li><li>3.hei</li></ul>";
String ss = ">[^<]+<";
String temp = null;
Pattern pa = Pattern.compile(ss);
Matcher ma = null;
ma = pa.matcher(html);
while(ma.find()){
temp = ma.group();
if(temp!=null){
if(temp.startsWith(">")){
temp = temp.substring(1);
}
if(temp.endsWith("<")){
temp = temp.substring(0, temp.length()-1);
}
if(!temp.equalsIgnoreCase("")){
//System.out.println(temp);
return temp;
}
}
}
return null;
}
}