#include <bits/stdc++.h>
using namespace std;
string s;
int k, len;
int p[505][505], dp[505][505], t[505][505];
int rec(int pos, int sisa) {
  if (pos >= len) return 0;
  int &ret = dp[pos][sisa];
  if (ret != -1) return ret;
  ret = p[pos][len - 1];
  t[pos][sisa] = len;
  if (sisa) {
    for (int i = pos; i < len - 1; i++) {
      if (p[pos][i] + rec(i + 1, sisa - 1) < ret) {
        t[pos][sisa] = i + 1;
        ret = p[pos][i] + rec(i + 1, sisa - 1);
      }
    }
  }
  return ret;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> s >> k;
  len = s.length();
  for (int i = 0; i < len; i++) {
    for (int j = i; j < len; j++) {
      for (int l = i; l <= j; l++)
        if (s[l] != s[j - l + i]) p[i][j]++;
      p[i][j] >>= 1;
    }
  }
  memset(dp, -1, sizeof(dp));
  k--;
  cout << rec(0, k) << "\n";
  int poss = 0, sisaa = k;
  while (poss < len) {
    int nxt = t[poss][sisaa];
    if (poss) cout << '+';
    for (int i = poss; i < nxt; i++) {
      s[i] = s[poss + nxt - 1 - i];
      cout << s[i];
    }
    poss = nxt;
    sisaa--;
  }
  cout << "\n";
}
