#include <bits/stdc++.h>
using namespace std;
int a[502][502];
int b[502][502], c[502][502];
string s;
int n;
int f(int i, int j) {
  if (a[i][j] == 0) {
    if (i == j || i > j)
      a[i][j] = 1;
    else {
      a[i][j] = f(i + 1, j - 1);
      if (s[i] != s[j]) a[i][j]++;
    }
  }
  return a[i][j];
}
string fs(string s) {
  int n = s.size();
  for (int i = 0; i < n / 2; i++)
    if (s[i] != s[n - i - 1]) s[n - i - 1] = s[i];
  return s;
}
int main() {
  int t;
  getline(cin, s);
  cin >> t;
  n = s.length();
  s = ' ' + s;
  for (int i = 1; i <= n; i++)
    for (int j = i; j <= n; j++)
      if (a[i][j] == 0) a[i][j] = f(i, j);
  for (int k = 0; k <= t; k++) b[0][k] = 1;
  for (int i = 1; i <= n; i++) {
    b[i][1] = a[1][i];
    c[i][1] = i;
  }
  for (int i = 1; i <= n; i++)
    for (int k = 2; k <= t; k++) {
      b[i][k] = 2000000000;
      for (int j = 1; j < i; j++)
        if (b[j][k - 1] + a[j + 1][i] - 1 < b[i][k]) {
          b[i][k] = b[j][k - 1] + a[j + 1][i] - 1;
          c[i][k] = i - j;
        }
    }
  int ans = 2000000000, mini;
  string sans = "";
  for (int k = 1; k <= t; k++)
    if (b[n][k] < ans) {
      ans = b[n][k];
      mini = k;
    }
  cout << ans - 1 << endl;
  int i = n, k = mini;
  while (i > 0 && k > 0) {
    sans = fs(s.substr(i - c[i][k] + 1, c[i][k])) + '+' + sans;
    i -= c[i][k];
    k--;
  }
  sans.erase(sans.size() - 1, 1);
  cout << sans << endl;
  return 0;
}
