#include <bits/stdc++.h>
using namespace std;
ifstream fin("AAtest.in.txt");
string s;
int k, tab[505][505], c = 500;
pair<int, int> pr[505][505];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cerr.tie(0);
  cin >> s >> k;
  int n = s.size();
  for (int(i) = (0); ((i)) < ((n)); ((i))++) {
    for (int(j) = (0); ((j)) < ((i + 1)); ((j))++) {
      int l = 0, v = 0;
      while (j + l <= i - l) {
        if (s[j + l] != s[i - l]) v++;
        l++;
      }
      tab[j][i] = v;
    }
  }
  for (int(i) = (0); ((i)) < ((n)); ((i))++)
    pr[0][i].first = tab[0][i], pr[0][i].second = 0;
  int su, in;
  for (int(i) = (0); ((i)) < ((k)); ((i))++)
    if (i) {
      for (int(j) = (0); ((j)) < ((n)); ((j))++) {
        su = c, in = -1;
        for (int l = i; l <= j; l++)
          if (su > pr[i - 1][l - 1].first + tab[l][j]) {
            su = pr[i - 1][l - 1].first + tab[l][j];
            in = l - 1;
          }
        pr[i][j].first = su, pr[i][j].second = in;
      }
    }
  su = c;
  for (int(i) = (0); ((i)) < ((k)); ((i))++)
    if (pr[i][n - 1].first < su) su = pr[i][n - 1].first, in = i;
  vector<int> va;
  int i = n - 1;
  do {
    va.emplace_back(i);
    i = pr[in][i].second;
    in--;
  } while (in > -1);
  reverse(va.begin(), va.end());
  cout << su << endl;
  in = 0;
  for (int i : va) {
    int l = 0;
    while (in + l <= i - l) {
      s[in + l] = s[i - l];
      l++;
    }
    cout << s.substr(in, i - in + 1);
    if (i != n - 1) cout << "+";
    in = i + 1;
  }
}
