#include <bits/stdc++.h>
using namespace std;
long long n, k, cnt[502][502], dp[502][502], pre[502][502];
string ans[502][502], s;
void solve() {
  cin >> s >> k;
  n = (long long)s.size();
  for (long long i = 0; i < n; i++) {
    for (long long j = i; j < n; j++) {
      long long l = j - i + 1;
      ans[i][j] = s.substr(i, l);
      long long lo = i, hi = j;
      while (lo < hi) {
        if (s[lo] != s[hi]) {
          cnt[i][j]++;
          ans[i][j][lo - i] = s[hi];
        }
        lo++, hi--;
      }
    }
  }
  for (long long i = 0; i <= n; i++) {
    for (long long j = 0; j <= n; j++) dp[i][j] = 1e10;
  }
  dp[0][0] = 0;
  for (long long i = 0; i <= n; i++) {
    for (long long l = 1; l <= n - i; l++) {
      for (long long j = 0; j <= i; j++) {
        if (dp[i + l][j + 1] > dp[i][j] + cnt[i][i + l - 1]) {
          dp[i + l][j + 1] = dp[i][j] + cnt[i][i + l - 1];
          pre[i + l][j + 1] = i;
        }
      }
    }
  }
  long long val = 1e10, id = -1;
  for (long long i = 1; i <= k; i++) {
    if (val > dp[n][i]) {
      val = dp[n][i];
      id = i;
    }
  }
  cout << val << endl;
  long long en = n;
  vector<string> p;
  while (en != 0) {
    long long nx = pre[en][id];
    p.push_back(ans[nx][en - 1]);
    en = nx;
    id--;
  }
  reverse((p).begin(), (p).end());
  cout << p[0];
  for (long long i = 1; i < (long long)p.size(); i++) cout << "+" << p[i];
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
