object Main extends App {
  import scala.io.StdIn._
  val n = readInt()
  val crypt = readLine.trim
  val coordinate = crypt.foldLeft(Coordinate(0, 0)){
    case (pos, c) if 'A' to 'M' contains c ⇒ pos.copy(y = pos.y - 1)
    case (pos, c) if 'N' to 'Z' contains c ⇒ pos.copy(y = pos.y + 1)
    case (pos, c) if 'a' to 'm' contains c ⇒ pos.copy(x = pos.x + 1)
    case (pos, c) if 'n' to 'z' contains c ⇒ pos.copy(x = pos.x - 1)
    case _ ⇒ ???
  }
  println(math.abs(coordinate.x) + math.abs(coordinate.y))
  println(encrypt(coordinate))

  case class Coordinate(x: Int, y: Int) {
    def +(that: Coordinate): Coordinate = Coordinate(x + that.x, y + that.y)
  }
  def encrypt(coordinate: Coordinate): String = {
    coordinate match {
      case Coordinate(x, y) if x >= 0 && y >= 0 ⇒ "N" * y + "a" * x
      case Coordinate(x, y) if x >= 0 ⇒ "A" * -y + "a" * x
      case Coordinate(x, y) if x < 0 && y < 0 ⇒ "A" * -y + "n" * -x
      case Coordinate(x, y) ⇒ "N" * y + "n" * -x
    }
  }
}
