#include <bits/stdc++.h>
using namespace std;
struct _ {
  _() { ios_base::sync_with_stdio(0); }
} _;
template <class A, class B>
ostream &operator<<(ostream &o, pair<A, B> t) {
  o << "(" << t.first << ", " << t.second << ")";
  return o;
}
template <class T>
void PV(T a, T b) {
  while (a != b) cout << *a++, cout << (a != b ? " " : "\n");
}
template <class T>
inline bool chmin(T &a, T b) {
  return a > b ? a = b, 1 : 0;
}
template <class T>
inline bool chmax(T &a, T b) {
  return a < b ? a = b, 1 : 0;
}
template <class T>
string tostring(T first, int len = 0) {
  stringstream ss;
  ss << first;
  string r = ss.str();
  if (r.length() < len) r = string(len - r.length(), '0') + r;
  return r;
}
template <class T>
void convert(string first, T &r) {
  stringstream ss(first);
  ss >> r;
}
const int inf = 0x3f3f3f3f;
const int mod = int(1e9) + 7;
const int N = 555;
string s;
int n, K;
int w[N][N];
int dp[N][N];
int p[N][N];
int main() {
  cin >> s >> K;
  n = s.length();
  for (int l = 1; l <= n; l++)
    for (int i = 0; i + l - 1 < n; i++) {
      int j = i + l - 1;
      if (i == j) {
        w[i][j] = 0;
      } else {
        w[i][j] = w[i + 1][j - 1] + (s[i] != s[j]);
      }
    }
  memset(dp, 0x3f, sizeof(dp));
  ;
  dp[0][0] = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= K; j++)
      for (int k = 0; k < i; k++) {
        if (chmin(dp[i][j], dp[k][j - 1] + w[k][i - 1])) p[i][j] = k;
      }
  int res = inf;
  int cnt = 0;
  for (int i = 1; i <= K; i++)
    if (chmin(res, dp[n][i])) cnt = i;
  vector<pair<int, int>> r;
  int pi = n, pj = cnt;
  for (; cnt > 0; cnt--) {
    r.push_back(make_pair(p[pi][cnt], pi));
    pi = p[pi][cnt];
  }
  reverse((r).begin(), (r).end());
  cout << res << endl;
  for (int i = 0; i < r.size(); i++) {
    int L = r[i].first;
    int R = r[i].second - 1;
    string ps = s.substr(L, R - L + 1);
    for (int j = 0; 2 * j < ps.length(); j++) {
      if (j != ps.length() - j - 1) ps[j] = ps[ps.length() - j - 1];
    }
    cout << ps;
    if (i + 1 != r.size())
      cout << "+";
    else
      cout << endl;
  }
  return 0;
}
