#include <bits/stdc++.h>
using namespace std;
const long double pi = 3.1415926535897932384626433832795;
const long double eps = 1e-9;
int ans[505][505], dp[550][505], p[505][505];
int main() {
  string s;
  cin >> s;
  int n = s.length();
  for (int i = 0; i < n; ++i)
    for (int j = i; j < n; ++j)
      for (int k = 0; k < (j - i + 1) / 2; ++k)
        if (s[i + k] != s[j - k]) ++ans[i][j];
  int k;
  scanf("%d", &k);
  for (int i = 0; i <= n; ++i)
    for (int j = 0; j <= k; ++j) dp[i][j] = 1e9;
  dp[0][0] = 0;
  for (int i = 0; i < n; ++i)
    for (int j = 1; j <= k; ++j)
      for (int l = 0; l <= i; ++l)
        if (dp[i + 1][j] > dp[l][j - 1] + ans[l][i]) {
          dp[i + 1][j] = dp[l][j - 1] + ans[l][i];
          p[i + 1][j] = l;
        }
  int best = 1;
  for (int i = 1; i <= k; ++i)
    if (dp[n][i] < dp[n][best]) best = i;
  cout << dp[n][best] << endl;
  vector<string> t;
  int cur = n;
  while (best) {
    t.push_back(s.substr(p[cur][best], cur - p[cur][best]));
    cur = p[cur][best];
    --best;
  }
  reverse(t.begin(), t.end());
  for (int i = 0; i < t.size(); ++i) {
    if (i) cout << "+";
    for (int j = 0; j < t[i].length(); ++j)
      if (t[i][j] != t[i][t[i].length() - 1 - j])
        t[i][j] = t[i][t[i].length() - 1 - j];
    cout << t[i];
  }
  cout << endl;
}
