private Automaton transpositionsOf(String s){
  if (s.length() < 2) {
    return Automata.makeEmpty();
  }
  List<Automaton> list=new ArrayList<>();
  for (int i=0; i < s.length() - 1; i++) {
    StringBuilder sb=new StringBuilder();
    sb.append(s.substring(0,i));
    sb.append(s.charAt(i + 1));
    sb.append(s.charAt(i));
    sb.append(s.substring(i + 2,s.length()));
    String st=sb.toString();
    if (!st.equals(s)) {
      list.add(Automata.makeString(st));
    }
  }
  Automaton a=Operations.union(list);
  a=MinimizationOperations.minimize(a,DEFAULT_MAX_DETERMINIZED_STATES);
  return a;
}

private Automaton transpositionsOf ( String s ) { if ( s . length ( ) < 2 ) { return Automata . makeEmpty ( ) ; } List < Automaton > list = new ArrayList < > ( ) ; for ( int i = 0 ; i < s . length ( ) - 1 ; i ++ ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( s . substring ( 0 , i ) ) ; sb . append ( s . charAt ( i + 1 ) ) ; sb . append ( s . charAt ( i ) ) ; sb . append ( s . substring ( i + 2 , s . length ( ) ) ) ; String st = sb . toString ( ) ; if ( ! st . equals ( s ) ) { list . add ( Automata . makeString ( st ) ) ; } } Automaton a = Operations . union ( list ) ; a = MinimizationOperations . minimize ( a , DEFAULT_MAX_DETERMINIZED_STATES ) ; return a ; }
return an automaton that accepts all transpositions of s ( transposing two adjacent characters )
