import java.util.*;
import java.io.*;

public class Sam41 {
  static CharToknizer tok;
  public static void main(String[] args) throws Exception {
    tok = new CharToknizer(args[0]);
    int stat = 0;
    while(true) {
      switch(stat) {
case 0: if(tok.chkfwd("a")) { stat = 1; continue; }
        break;
case 1: if(tok.chkfwd("a")) { stat = 1; continue; }
        if(tok.chkfwd("b")) { stat = 2; continue; }
        break;
case 2: if(tok.chkfwd("b")) { stat = 2; continue; }
        if(tok.chkfwd("$")) { System.out.println("accept."); return; }
        break;
      }
      System.out.println("error."); return;
    }
  }
}
class CharToknizer {
  String str, tok;
  int pos = -1;
  boolean eof = false;
  public CharToknizer(String s) { str = s; fwd(); }
  public boolean isEof() { return eof; }
  public String curTok() { return tok; }
  public boolean chk(String s) { return tok.equals(s); }
  public void fwd() {
    if(eof) { return; }
    pos += 1;
    if(pos >= str.length()) { eof = true; tok = "$"; return; }
    tok = str.substring(pos, pos+1);
  }
  public boolean chkfwd(String s) {
    if(chk(s)) { fwd(); return true; } else { return false; }
  }
}
public class Sam42 {
  public static void main(String[] args) {
    String str = args[0], psym = "abSTU"; // a:0, b:1, S:2, T:3, U:4
    int n = str.length(), nsym = psym.length(), start = psym.indexOf("S");
    int[] a = new int[n];
    for(int i = 0; i < n; ++i) { a[i] = psym.indexOf(str.charAt(i)+""); }
    int[][] p1 = { {2,0}, {4,1} };        // S -> a, U -> b
    int[][] p2 = { {2,2,3}, {3,4,2} };    // S -> S T, T -> U S
    boolean[][][] p = new boolean[n][n+1][nsym];
    for(int i = 0; i < n; ++i) {
      for(int r = 0; r < p1.length; ++r) {
        int x = p1[r][0], y = p1[r][1];
        if(a[i] == y) { p[i][1][x] = true; }
      }
    }
    for(int i = 2; i <= n; ++i) {
      for(int k = 1; k < i; ++k) {
        for(int j = 0; j < n-i+1; ++j) {
          for(int r = 0; r < p2.length; ++r) {
            int x = p2[r][0], y = p2[r][1], z = p2[r][2];
            if(p[j][k][y] && p[j+k][i-k][z]) { p[j][i][x] = true;}
//            System.err.printf(i+":"+j+":"+k+":"+x+":"+y+":"+z+p[j][i][x]);
          }
        }
      }
    }
    System.out.println(p[0][n][start]); // 結果表示
    for(int i = 1; i <= n; ++i) {       // 配列p表示
      System.out.println("---- " + i + " -----");
      System.out.println("  " + str);
      for(int s = 0; s < nsym; ++s) {
        System.out.print(psym.charAt(s) + " ");
        for(int j = 0; j < n; ++j) { System.out.print(p[j][i][s]?"t":"."); }
        System.out.println();
      }
    }
  }
}