private static Optimizer find(Term term,int dist){
//System.out.println("term="+term+", dist="+dist);
if(term==null) return null;
Term next=term.next;
TermType type=term.type;
switch(type){
case CHAR:
case REG:
case REG_I:
return new Optimizer(term,dist);