#include <bits/stdc++.h>
using namespace std;
const int dx[4] = {0, 1, 0, -1};
const int dy[4] = {1, 0, -1, 0};
const int inf = 1010101010;
const double PI = 4 * atan(1);
int main() {
  string s;
  cin >> s;
  int n = ((int)(s).size());
  int k;
  cin >> k;
  vector<vector<int> > a(n + 1, vector<int>(n + 1));
  for (int i = 0; i < (n); i++)
    for (int j = i + 1; j <= n; j++) {
      int le = j - i;
      for (int k = 0; k < (le / 2); k++)
        if (s[i + k] != s[j - 1 - k]) a[i][j]++;
    }
  vector<vector<int> > opt(n + 1, vector<int>(k + 1, inf));
  vector<vector<int> > choice(n + 1, vector<int>(k + 1));
  opt[0][0] = 0;
  for (int j = 1; j <= n; j++) {
    for (int kk = 1; kk <= k; kk++) {
      for (int i = 0; i < (j); i++) {
        int x = a[i][j] + opt[i][kk - 1];
        if (opt[j][kk] > x) {
          opt[j][kk] = x;
          choice[j][kk] = i;
        }
      }
    }
  }
  int mi = inf, kk;
  for (int i = 0; i < (k + 1); i++)
    if (opt[n][i] < mi) {
      mi = opt[n][i], kk = i;
    }
  vector<string> v;
  int pt = n;
  while (pt) {
    int i = choice[pt][kk];
    string s1;
    for (int ii = i; ii < pt; ii++) {
      if (ii - i <= pt - 1 - ii)
        s1 += s[ii];
      else
        s1 += s[i + (pt - 1 - ii)];
    }
    v.push_back(s1);
    pt = i;
    kk--;
  }
  cout << mi << endl;
  for (int i = 0; i < (((int)(v).size())); i++) {
    if (i) cout << "+";
    cout << v[((int)(v).size()) - 1 - i];
  }
  cout << endl;
}
