#include <bits/stdc++.h>
using namespace std;
int N, K;
char V[510];
int dp[510][510], pal[510][510], pp[510][510];
int change(int f, int t) {
  if (f > t) return 0;
  int& T = pal[f][t];
  if (T != -1) return T;
  return T = change(f + 1, t - 1) + (V[f] != V[t]);
}
void out(int f, int t) {
  if (f > t) return;
  if (f == t) {
    printf("%c", V[f]);
    return;
  }
  printf("%c", V[f]);
  out(f + 1, t - 1);
  printf("%c", V[f]);
}
int main() {
  gets(V);
  N = strlen(V);
  scanf("%d", &K);
  memset(dp, -1, sizeof dp);
  memset(pal, -1, sizeof pal);
  for (int i = 0; i <= K; ++i) dp[0][i] = 0;
  for (int i = 0; i < N; ++i)
    for (int j = 0; j < N; ++j) change(i, j);
  for (int P = 1; P <= N; ++P) {
    dp[P][0] = 1000000000;
    for (int gr = 1; gr <= K; ++gr) {
      int &T = dp[P][gr], &W = pp[P][gr];
      T = 1000000000;
      for (int L = 0; L < P; ++L)
        if (pal[L][P - 1] + dp[L][gr - 1] < T) {
          W = L;
          T = pal[L][P - 1] + dp[L][gr - 1];
        }
    }
  }
  printf("%d\n", dp[N][K]);
  vector<pair<int, int> > ap;
  int P = N, GR = K;
  while (P) {
    ap.push_back(pair<int, int>(pp[P][GR], P - 1));
    P = pp[P][GR];
    --GR;
  }
  for (int i = ap.size() - 1; i >= 0; --i) {
    out(ap[i].first, ap[i].second);
    if (i)
      printf("+");
    else
      printf("\n");
  }
  return 0;
}
