#include <bits/stdc++.h>
using namespace std;
int const mod = 1e9 + 7;
int cost(string s, int x, int y) {
  int ans = 0;
  x--;
  y--;
  for (int i = x; i <= x + (y - x) / 2; i++) {
    if (s[i] != s[y + x - i]) ans++;
  }
  return ans;
}
int t[501][501];
int dp[505][505];
vector<int> pl[505][505];
int main() {
  string ss;
  cin >> ss;
  int k;
  cin >> k;
  int l = ss.length();
  for (int i = 1; i <= l; i++) {
    for (int j = i; j <= l; j++) {
      t[i][j] = cost(ss, i, j);
    }
  }
  for (int i = 1; i <= l; i++) {
    dp[i][1] = t[1][i];
    pl[i][1].push_back(i);
  }
  for (int i = 2; i <= k; i++) {
    for (int j = i; j <= l; j++) {
      int tmp = 5000;
      int holder;
      for (int h = 1; h <= j - i + 1; h++) {
        if (dp[j - h][i - 1] + t[j - h + 1][j] < tmp) {
          tmp = dp[j - h][i - 1] + t[j - h + 1][j];
          holder = j - h;
        }
      }
      dp[j][i] = tmp;
      pl[j][i] = pl[holder][i - 1];
      pl[j][i].push_back(j);
    }
  }
  int ans;
  int tmp = 5000;
  for (int i = 1; i <= k; i++) {
    if (dp[l][i] < tmp) {
      tmp = dp[l][i];
      ans = i;
    }
  }
  int c = 0;
  cout << tmp << endl;
  for (int i = 0; i < pl[l][ans][0]; i++) {
    if (ss[i] != ss[pl[l][ans][0] - 1 - i]) ss[i] = ss[pl[l][ans][0] - 1 - i];
  }
  for (int i = 0; i < pl[l][ans].size() - 1; i++) {
    for (int j = pl[l][ans][i]; j < pl[l][ans][i + 1]; j++) {
      if (ss[j] != ss[pl[l][ans][i + 1] + pl[l][ans][i] - j - 1])
        ss[j] = ss[pl[l][ans][i + 1] + pl[l][ans][i] - j - 1];
    }
  }
  for (int i = 0; i < l; i++) {
    if (pl[l][ans].size() != 0)
      if (pl[l][ans][c] == i) {
        cout << "+";
        if (c < pl[l][ans].size() - 2) c++;
      }
    cout << ss[i];
  }
}
