#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int k, n = s.size();
  cin >> k;
  vector<vector<int> > dp1(n + 4, vector<int>(n + 4)),
      dp2(n + 4, vector<int>(k + 4, n)), dp3(n + 4, vector<int>(k + 4, -1));
  int l, r;
  for (int i = 0; i < n; i++) {
    for (int j = i; j <= n; j++) {
      l = i;
      r = j;
      while (l <= r) {
        if (s[l] != s[r]) {
          dp1[i][j]++;
        }
        l++;
        r--;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    dp2[i][1] = dp1[0][i];
    for (int j = 2; j <= k; j++) {
      for (int p = 0; p < i; p++) {
        if (dp2[i][j] > dp1[p + 1][i] + dp2[p][j - 1]) {
          dp2[i][j] = dp1[p + 1][i] + dp2[p][j - 1];
          dp3[i][j] = p;
        }
      }
    }
  }
  int cnt = n, idx = -1, mink;
  for (int j = 1; j <= k; j++) {
    if (cnt > dp2[n - 1][j]) {
      cnt = dp2[n - 1][j];
      mink = j;
      idx = dp3[n - 1][j];
    }
  }
  vector<int> indices;
  indices.push_back(idx + 1);
  while (idx > -1) {
    mink--;
    idx = dp3[idx][mink];
    indices.push_back(idx + 1);
  }
  reverse(indices.begin(), indices.end());
  cout << cnt << endl;
  for (int i = 0; i < indices.size() - 1; i++) {
    l = indices[i];
    r = indices[i + 1] - 1;
    while (l <= r) {
      if (s[l] != s[r]) {
        s[r] = s[l];
      }
      l++;
      r--;
    }
    cout << s.substr(indices[i], indices[i + 1] - indices[i]) + "+";
  }
  l = indices[indices.size() - 1], r = n - 1;
  while (l <= r) {
    if (s[l] != s[r]) {
      s[r] = s[l];
    }
    l++;
    r--;
  }
  cout << s.substr(indices[indices.size() - 1],
                   n - indices[indices.size() - 1]);
  cout << endl;
}
