#include <bits/stdc++.h>
using namespace std;
char inp[510];
int n;
const int INF = 1000000000;
int store[510][510];
int dp[510][510];
int f(int i, int k) {
  if (dp[i][k] != -1) return dp[i][k];
  if (i >= n) return dp[i][k] = 0;
  if (k <= 0) return dp[i][k] = INF;
  int ret = INF;
  for (int j = i; j < n; j++) {
    ret = min(ret, store[i][j] + f(j + 1, k - 1));
  }
  return dp[i][k] = ret;
}
void of(int i, int k) {
  if (i >= n) return;
  if (k <= 0) return;
  int ret = INF;
  int idx = -1;
  for (int j = i; j < n; j++) {
    if (ret > store[i][j] + f(j + 1, k - 1)) {
      ret = store[i][j] + f(j + 1, k - 1);
      idx = j;
    }
  }
  int li = idx;
  int t = i;
  for (t = i; t < li; t++, li--) {
    printf("%c", inp[li]);
  }
  for (; t <= idx; t++) printf("%c", inp[t]);
  if (idx + 1 < n) printf("+");
  of(idx + 1, k - 1);
}
int main() {
  scanf("%s", inp);
  n = strlen(inp);
  int k;
  scanf("%d", &k);
  for (int i = n - 1; i >= 0; i--) {
    for (int j = i; j < n; j++) {
      int cnt = 0;
      if (inp[i] != inp[j]) cnt++;
      if (i + 1 <= j - 1) cnt += store[i + 1][j - 1];
      store[i][j] = cnt;
    }
  }
  memset(dp, -1, sizeof(dp));
  int ret = f(0, k);
  printf("%d\n", ret);
  of(0, k);
  cout << endl;
  return 0;
}
