#include <bits/stdc++.h>
using namespace std;
const int INF = (int)(1e9 + 7);
const double EPS = 1e-6;
const int MAXN = (int)(1e5 + 500);
int n, k, x, y, dp[1000][1000], dp2[1000][1000], pr[1000][1000];
string second;
int ans = 0;
vector<string> vec;
int main() {
  srand(time(0));
  cin >> second >> k;
  n = second.size();
  second = "#" + second;
  for (int i = 1; i <= n; i++) {
    x = 1;
    y = i;
    while (x <= n && y <= n) {
      if (x == y)
        dp[x][y] = 0;
      else if (x + 1 == y) {
        if (second[x] == second[y])
          dp[x][y] = 0;
        else
          dp[x][y] = 1;
      } else {
        if (second[x] == second[y])
          dp[x][y] = dp[x + 1][y - 1];
        else
          dp[x][y] = dp[x + 1][y - 1] + 1;
      }
      x++;
      y++;
    }
  }
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= k; j++) dp2[i][j] = INF;
  dp2[0][0] = 0;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j < k; j++)
      if (dp2[i][j] < INF)
        for (int len = 1; i + len <= n; len++)
          if (dp2[i + len][j + 1] > dp2[i][j] + dp[i + 1][i + len]) {
            dp2[i + len][j + 1] = dp2[i][j] + dp[i + 1][i + len];
            pr[i + len][j + 1] = len;
          }
  int z;
  ans = INF;
  for (int j = 1; j <= k; j++) {
    if (ans > dp2[n][j]) {
      ans = dp2[n][j];
      z = j;
    }
  }
  cout << ans << endl;
  x = n;
  y = z;
  int pos = n;
  while (true) {
    if (x == 0 && y == 0) break;
    int ln = pr[x][y];
    int ln2 = ln;
    string s1 = "";
    while (ln2 > 0) {
      s1 += second[pos];
      pos--;
      ln2--;
    }
    vec.push_back(s1);
    x -= ln;
    y--;
  }
  for (int i = vec.size() - 1; i >= 0; i--)
    for (int j = 0; j < vec[i].size(); j++)
      if (vec[i][j] != vec[i][vec[i].size() - 1 - j])
        vec[i][j] = vec[i][vec[i].size() - 1 - j];
  for (int i = vec.size() - 1; i >= 0; i--)
    if (i != 0)
      cout << vec[i] << "+";
    else
      cout << vec[i];
  return 0;
}
