#include <bits/stdc++.h>
using namespace std;
string s;
const long long MAXN = 600;
long long k, cnt[MAXN][MAXN], n, dp[MAXN][MAXN], dad[MAXN][MAXN], mindp, minj,
    j, ji, t[MAXN];
void T(long long l, long long r) {
  if (l == r) return;
  for (long long i = l; i <= (l + r) / 2; i++) {
    s[i] = s[r - i + l];
  }
}
long long h;
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  ;
  cin >> s >> k;
  n = s.size();
  for (long long i = 0; i < n; i++) {
    h = 0;
    for (long long j = 0; j <= n; j++) {
      if (i + j >= n || i - j < 0) break;
      if (s[i - j] != s[i + j]) h++;
      cnt[i - j][i + j] = h;
    }
  }
  for (long long i = 1; i < n; i++) {
    h = 0;
    for (long long j = 0; j <= n; j++) {
      if (i - j - 1 < 0 || i + j >= n) break;
      if (s[i - j - 1] != s[i + j]) h++;
      cnt[i - j - 1][i + j] = h;
    }
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j <= k; j++) {
      if (j <= 1 || i == 0) {
        dp[i][j] = cnt[0][i];
        dad[i][j] = -1;
        continue;
      }
      dp[i][j] = 510;
      dad[i][j] = -1;
      if (i + 1 < j) break;
      for (long long d = 0; d < i; d++) {
        if (dp[i][j] > dp[d][j - 1] + cnt[d + 1][i]) {
          dp[i][j] = dp[d][j - 1] + cnt[d + 1][i];
          dad[i][j] = d;
        }
      }
    }
  }
  mindp = 510;
  for (long long j = 1; j <= k; j++)
    if (dp[n - 1][j] < mindp) {
      mindp = dp[n - 1][j];
      minj = j;
    }
  j = minj;
  ji = j;
  t[0] = -1;
  long long x = n - 1;
  while (ji > 1) {
    if (dad[x][ji] == -1) break;
    x = dad[x][ji];
    t[ji - 2] = x;
    ji--;
  }
  x = 0;
  cout << mindp << endl;
  for (long long i = 0; i < j - ji; i++) {
    T(x, t[i]);
    x = t[i] + 1;
  }
  T(x, n - 1);
  ji = 0;
  for (long long i = 0; i < s.size(); i++) {
    cout << s[i];
    if (t[ji] == i) cout << "+", ji++;
  }
}
