#include <bits/stdc++.h>
using namespace std;
const int inf = 1 << 30;
const long long linf = 1LL << 60;
const int maxn = 500 + 5;
const int maxk = 500 + 5;
bool st[maxn];
int D[maxn][maxk];
int P[maxn][maxk];
int getr(string& s, int l, int r) {
  int res = 0;
  for (int i = 0; i < (r - l + 1) / 2; ++i)
    if (s[l + i] != s[r - i]) ++res;
  return res;
}
void setr(string& s, int l, int r) {
  for (int i = 0; i < (r - l + 1) / 2; ++i) s[r - i] = s[l + i];
}
int main() {
  string s;
  cin >> s;
  int k;
  cin >> k;
  int n = (int)(s).size();
  for (int i = 0; i < n; ++i)
    for (int j = 0; j <= k; ++j) D[i][j] = inf;
  for (int i = 0; i < n; ++i) {
    for (int j = i; j < n; ++j) {
      int r = getr(s, i, j);
      if (!i) {
        if (D[j][1] > r) {
          D[j][1] = r;
          P[j][1] = -1;
        }
      } else {
        for (int l = 0; l < k; ++l)
          if (D[j][l + 1] > D[i - 1][l] + r) {
            D[j][l + 1] = D[i - 1][l] + r;
            P[j][l + 1] = i - 1;
          }
      }
    }
  }
  int nk = k;
  for (int i = 0; i <= k; ++i) {
    if (D[n - 1][i] < D[n - 1][nk]) nk = i;
  }
  k = nk;
  cout << D[n - 1][k] << "\n";
  int pos = n - 1;
  for (int i = k; i >= 1; --i) {
    st[pos] = 1;
    setr(s, P[pos][i] + 1, pos);
    pos = P[pos][i];
  }
  for (int i = 0; i < n; ++i) {
    putchar(s[i]);
    if (st[i] && i < n - 1) putchar('+');
  }
  cout << "\n";
  return 0;
}
