#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int n, p, i, j, k, c[505][505], dp[505][505], indices[505][505];
  cin >> s >> p;
  n = s.length();
  for (i = 0; i < n; i++) {
    for (j = i; j < n; j++) {
      int cost = 0;
      int a = i, b = j;
      while (a < b) {
        if (s[a] != s[b]) cost++;
        a++;
        b--;
      }
      c[i][j] = cost;
    }
  }
  for (i = 0; i < n; i++) {
    dp[i][1] = c[i][n - 1];
    indices[i][1] = n - 1;
  }
  for (i = 2; i <= p; i++) {
    for (j = 0; j < n; j++) {
      int cost = 1000000000, minInd = 0;
      for (k = j; k <= n - i + 1; k++) {
        if (c[j][k] + dp[k + 1][i - 1] < cost) {
          cost = c[j][k] + dp[k + 1][i - 1];
          minInd = k;
        }
      }
      dp[j][i] = cost;
      indices[j][i] = minInd;
    }
  }
  int cost = 1000000000, minInd = 0;
  for (i = 1; i <= p; i++) {
    if (dp[0][i] < cost) {
      cost = dp[0][i];
      minInd = i;
    }
  }
  cout << cost << endl;
  i = minInd;
  int a = 0, b = indices[a][minInd], x, y;
  vector<string> res;
  while (true) {
    string st = s.substr(a, b - a + 1);
    if (0) cout << a << " " << b << " " << st << endl;
    x = 0;
    y = b - a;
    while (x < y) {
      st[y] = st[x];
      x++;
      y--;
    }
    if (0) cout << st << endl;
    res.push_back(st);
    i--;
    if (i == 0) break;
    a = b + 1;
    b = indices[a][i];
  }
  cout << res[0];
  for (i = 1; i < res.size(); i++) cout << "+" << res[i];
  cout << endl;
  return 0;
}
