#include <bits/stdc++.h>
using namespace std;
double const EPS = 1e-9, PI = acos(-1);
const int N = 1e5 + 9, M = 5e2 + 9, OO = 1e9 + 7, MOD = 1e9 + 7;
const long long inf = 1e18;
int n, mem[M][M], mem2[M][M];
string str;
vector<char> vv;
int solve(int i, int j) {
  if (i >= j) return 0;
  int& ret = mem[i][j];
  if (~ret) return ret;
  ret = OO;
  if (str[i] == str[j]) return ret = solve(i + 1, j - 1);
  return ret = solve(i + 1, j - 1) + 1;
}
int solve2(int idx, int kk) {
  if (kk < 0) return OO;
  if (idx >= n) return 0;
  int& ret = mem2[idx][kk];
  if (~ret) return ret;
  ret = OO;
  for (int i = idx; i < n; ++i)
    ret = min(ret, solve2(i + 1, kk - (i + 1 != n)) + solve(idx, i));
  return ret;
}
void print(int idx, int kk) {
  if (kk < 0 || idx >= n) return;
  if (idx) vv.push_back('+');
  int res = OO, ii = -1;
  for (int i = idx; i < n; ++i) {
    if (solve2(i + 1, kk - (i + 1 != n)) + solve(idx, i) <= res) {
      res = solve2(i + 1, kk - (i + 1 != n)) + solve(idx, i);
      ii = i;
    }
  }
  for (int i = idx; i <= idx + (ii - idx) / 2; ++i) vv.push_back(str[i]);
  vector<char> vee;
  for (int i = idx; i < idx + (ii - idx) / 2 + ((ii - idx) & 1); ++i)
    vee.push_back(str[i]);
  reverse(vee.begin(), vee.end());
  for (char it : vee) vv.push_back(it);
  print(ii + 1, kk - 1);
}
int main() {
  cout << fixed << setprecision(0), ios::sync_with_stdio(false),
      cin.tie(nullptr), cout.tie(nullptr);
  cin >> str;
  n = str.size();
  memset(mem, -1, sizeof mem);
  solve(0, n - 1);
  int k;
  cin >> k;
  --k;
  memset(mem2, -1, sizeof mem2);
  cout << solve2(0, k) << '\n';
  print(0, k);
  for (char it : vv) cout << it;
  return 0;
}
