[java]代码库
import java.util.Scanner;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Main {
public static void main(String[] args) throws Exception {
Scanner cin = new Scanner(System.in);
while (cin.hasNext()) {
String str = cin.next();
if(str.equals("end"))
break;
Pattern p1 = Pattern.compile("[aeiou]{3}|[^aeiou]{3}");
Pattern p2 = Pattern.compile("([a-df-np-z])\\1");
Pattern p3 = Pattern.compile("[aeiou]+");
Matcher m = p1.matcher(str);
boolean flag = false;
if(!m.find())
{
m = p2.matcher(str);
if(!m.find())
{
m = p3.matcher(str);
if(m.find())
flag = true;
}
}
if(flag)
System.out.println("<"+str+"> is acceptable.");
else
System.out.println("<"+str+"> is not acceptable.");
}
cin.close();
}
}//源代码片段来自云代码http://yuncode.net