#include <bits/stdc++.h>
using namespace std;
int f[505][505], dp[505][505], last[505][505];
char ch[505];
int n, st[505];
void output(int i, int j) {
  string a;
  for (int k = i; k <= j; k++) {
    if (k <= (i + j) / 2)
      a += ch[k];
    else
      a += ch[i + j - k];
  }
  cout << a;
}
int main() {
  scanf("%s", ch);
  int k;
  scanf("%d", &k);
  n = strlen(ch);
  memset(last, -1, sizeof(last));
  memset(f, 0, sizeof(f));
  for (int i = n; i > 0; i--)
    for (int j = i; j <= n; j++) {
      f[i][j] = f[i + 1][j - 1];
      if (ch[i - 1] != ch[j - 1]) f[i][j]++;
    }
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= n; j++) dp[i][j] = 1000000000;
  for (int i = 1; i <= n; i++) dp[1][i] = dp[0][i] = 0;
  dp[0][0] = 0;
  dp[1][1] = 0;
  for (int i = 2; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      for (int k = 1; k <= i; k++) {
        if (dp[i][j] >= dp[i - k][j - 1] + f[i - k + 1][i]) {
          last[i][j] = i - k;
          dp[i][j] = dp[i - k][j - 1] + f[i - k + 1][i];
        }
      }
    }
  }
  cout << dp[n][k] << endl;
  int top = 0, now = n, cnt = k;
  while (now != 0 && now != -1) {
    st[top++] = now;
    now = last[now][cnt--];
  }
  if (top > k)
    while (1)
      ;
  st[top] = 0;
  for (int i = top; i > 0; i--) {
    if (i == top)
      output(st[i], st[i - 1] - 1);
    else {
      cout << '+';
      output(st[i], st[i - 1] - 1);
    }
  }
  cout << endl;
  return 0;
}
