#include <bits/stdc++.h>
using namespace std;
struct maca {
  int r, p;
} dp[504][504];
int um[504][504], marka[509];
int main() {
  int k, i, j, x, a, b, n, d, t, res, mi, del, duz, h, y, du;
  string s, uros;
  cin >> s >> k;
  d = s.length();
  for (duz = 1; duz <= d; duz++) {
    for (j = duz - 1; j < d; j++) {
      i = j - duz + 1;
      x = i + 1;
      y = j + 1;
      if (duz == 1)
        um[x][y] = 0;
      else {
        if (duz == 2 && s[x - 1] == s[y - 1])
          um[x][y] = 0;
        else if (duz == 2)
          um[x][y] = 1;
        else if (s[x - 1] == s[y - 1])
          um[x][y] = um[x + 1][y - 1];
        else
          um[x][y] = um[x + 1][y - 1] + 1;
      }
    }
  }
  for (i = 0; i < d; i++) {
    for (j = 0; j <= k; j++) {
      dp[i + 1][j].r = -1;
      dp[i + 1][j].p = -1;
    }
  }
  dp[0][0].r = 0;
  dp[0][0].p = 0;
  for (j = 1; j <= d; j++) {
    for (del = 1; del <= min(j, k); del++) {
      for (h = del - 1; h <= j - 1; h++) {
        if (dp[h][del - 1].r != -1)
          if (dp[j][del].r == -1 ||
              dp[h][del - 1].r + um[h + 1][j] < dp[j][del].r) {
            dp[j][del].r = dp[h][del - 1].r + um[h + 1][j];
            dp[j][del].p = h;
          }
      }
    }
  }
  mi = d;
  for (i = 1; i <= k; i++) {
    if (dp[d][i].r < mi) {
      res = i;
      mi = dp[d][i].r;
    }
  }
  t = d;
  for (i = res; i > 0; i--) {
    x = dp[t][i].p;
    if (x != -1) marka[x] = 1;
    t = x;
  }
  cout << mi << endl;
  for (i = 0; i < d; i++) {
    uros = uros + s[i];
    if (marka[i + 1] == 1) uros = uros + "+";
  }
  du = uros.size();
  int pr = 0;
  for (i = 0; i < du; i++) {
    if (uros[i] == '+') {
      for (a = pr, b = i - 1; a <= b; a++, b--) uros[a] = uros[b];
      pr = i + 1;
    } else if (i == du - 1) {
      for (a = pr, b = i; a <= b; a++, b--) uros[a] = uros[b];
      pr = i + 1;
    }
  }
  cout << uros;
  return 0;
}
