#include <bits/stdc++.h>
using namespace std;
int f[510][510], g[510][510];
int pre[510][510], p[510];
string s;
int n, k;
int calc(int st, int ed) {
  int p1, p2, l, lim, tmp = 0;
  l = ed - st + 1;
  lim = (l + 1) / 2;
  if (l % 2 == 1)
    p1 = p2 = st + lim - 1;
  else {
    p1 = st + lim - 1;
    p2 = st + lim;
  }
  for (int i = 0; i < lim; i++) {
    if (s[p1] != s[p2]) tmp++;
    p1--;
    p2++;
  }
  return tmp;
}
void print(int l, int r) {
  int lim = (r - l + 1) / 2;
  for (int i = l; i < l + lim; i++) printf("%c", s[i]);
  for (int i = l + lim; i <= r; i++) printf("%c", s[l + (r - i)]);
}
int main() {
  getline(cin, s);
  scanf("%d", &k);
  s = "@" + s;
  n = (int)s.length() - 1;
  memset(g, 0, sizeof(g));
  for (int i = 1; i <= n; i++)
    for (int j = 0; j <= i; j++) g[i][j] = calc(i - j + 1, i);
  for (int i = 0; i < 510; i++)
    for (int j = 0; j < 510; j++) f[i][j] = 10000;
  f[0][0] = 0;
  memset(pre, 0, sizeof(pre));
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      for (int ll = 1; ll <= i; ll++)
        if (f[i - ll][j - 1] + g[i][ll] < f[i][j]) {
          f[i][j] = f[i - ll][j - 1] + g[i][ll];
          pre[i][j] = i - ll;
        }
  int ans = 10000, mini = 0;
  for (int i = 1; i <= k; i++)
    if (f[n][i] < ans) {
      ans = f[n][i];
      mini = i;
    }
  int x = n, y = mini, i = mini;
  while (x) {
    p[i] = x;
    x = pre[x][y];
    y--;
    i--;
  }
  cout << ans << endl;
  for (int i = 1; i <= mini; i++) {
    print(p[i - 1] + 1, p[i]);
    if (i != mini) cout << "+";
  }
  return 0;
}
