#include <bits/stdc++.h>
using namespace std;
template <class T>
void d_print(const T& vec) {
  copy(vec.begin(), vec.end(), ostream_iterator<int>(cout, " "));
  cout << endl;
}
const long long Mod = 1000000007;
const int N = 505;
int dp[N][N], num[N][N], he[N][N], n, k;
string str;
string go(const string& s) {
  string ret = s;
  int len = ret.length();
  for (int i = 0; i < (len + 1) / 2; ++i) ret[i] = ret[len - 1 - i];
  return ret;
}
void sol() {
  for (int(i) = (1); (i) <= (k); ++(i)) dp[0][i] = INT_MAX;
  dp[0][0] = 0;
  for (int(i) = (1); (i) <= (n); ++(i)) {
    dp[i][0] = INT_MAX;
    for (int(j) = (1); (j) <= (k); ++(j)) {
      dp[i][j] = INT_MAX;
      for (int(r) = (1); (r) <= (i); ++(r))
        if (dp[i - r][j - 1] != INT_MAX &&
            dp[i - r][j - 1] + num[i - r][i - 1] < dp[i][j]) {
          dp[i][j] = dp[i - r][j - 1] + num[i - r][i - 1];
          he[i][j] = i - r;
        }
    }
  }
  int ans = INT_MAX, _n, _k;
  vector<int> sav;
  for (int(i) = (1); (i) <= (k); ++(i))
    if (dp[n][i] < ans) {
      ans = dp[n][i];
      _k = i;
    }
  cout << ans << endl;
  _n = n;
  while (_n) {
    _n = he[_n][_k];
    --_k;
    sav.push_back(_n);
  }
  reverse(sav.begin(), sav.end());
  int sz = sav.size();
  for (int i = 0; i < sz - 1; ++i) {
    cout << go(str.substr(sav[i], sav[i + 1] - sav[i])) << '+';
  }
  cout << go(str.substr(sav.back(), n - sav.back()));
}
int main() {
  cin >> str >> k;
  n = str.length();
  for (int(i) = (0); (i) <= (n - 1); ++(i)) dp[i][i] = 0;
  for (int(i) = (0); (i) <= (n - 2); ++(i))
    num[i][i + 1] = (str[i] != str[i + 1]);
  for (int(len) = (3); (len) <= (n); ++(len))
    for (int(i) = (0); (i) <= (n - len); ++(i)) {
      int j = i + len - 1;
      num[i][j] = num[i + 1][j - 1] + (str[i] != str[j]);
    }
  sol();
  return 0;
}
