#include <bits/stdc++.h>
int INF = 1 << 30;
int tt[505][505];
int bb[505][505];
char ss[505];
void meow(int b, int l) {
  if (l == 0) return;
  if (l == 1)
    printf("%c", ss[b]);
  else {
    printf("%c", ss[b]);
    meow(b + 1, l - 2);
    printf("%c", ss[b]);
  }
}
void maw(int k, int e) {
  if (k == 0) {
    meow(0, e + 1);
    return;
  }
  if (bb[k - 1][e] == bb[k][e])
    maw(k - 1, e);
  else {
    for (int p = 0; p <= e; p++) {
      if (bb[k - 1][p] + tt[p + 1][e - p] == bb[k][e]) {
        maw(k - 1, p), printf("+"), meow(p + 1, e - p);
        return;
      }
    }
  }
}
int main() {
  scanf("%s", ss);
  int k, len = strlen(ss);
  scanf("%d", &k);
  for (int i = 0; i < len; i++) {
    tt[i][0] = 0;
    tt[i][1] = 0;
  }
  for (int l = 2; l <= len; l++) {
    for (int b = 0; b + l - 1 < len; b++) {
      int f = b + l - 1;
      if (ss[b] == ss[f])
        tt[b][l] = tt[b + 1][l - 2];
      else
        tt[b][l] = 1 + tt[b + 1][l - 2];
    }
  }
  for (int e = 0; e < len; e++) {
    bb[0][e] = tt[0][e + 1];
  }
  for (int i = 1; i < k; i++) {
    for (int e = 0; e < len; e++) {
      bb[i][e] = bb[i - 1][e];
      for (int p = 0; p <= e; p++) {
        if (bb[i - 1][p] + tt[p + 1][e - p] < bb[i][e])
          bb[i][e] = bb[i - 1][p] + tt[p + 1][e - p];
      }
    }
  }
  printf("%d\n", bb[k - 1][len - 1]);
  maw(k - 1, len - 1);
  printf("\n");
}
