#include <bits/stdc++.h>
using namespace std;
const int N = 500 + 5;
const int INF = 0x3f3f3f3f;
char str[N];
int m, dp[N][N], pre[N][N], cost[N][N];
void prepare() {
  int n = strlen(str + 1);
  for (int i = n; i >= 1; i--) {
    for (int j = i + 1; j <= n; j++) {
      cost[i][j] = cost[i + 1][j - 1] + (str[i] != str[j]);
    }
  }
}
void print(int n, int m) {
  int p = pre[n][m];
  if (p != 1) {
    print(p - 1, m - 1);
  }
  for (int i = p, j = n; i < j; i++, j--) {
    str[i] = str[j];
  }
  for (int i = p; i <= n; i++) {
    putchar(str[i]);
  }
  printf("%s", str[n + 1] ? "+" : "\n");
}
void work() {
  prepare();
  memset(dp, 0x3f, sizeof(dp));
  dp[0][0] = 0;
  int n = strlen(str + 1);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      for (int k = 1; k <= i; k++) {
        if (dp[i][j] > dp[k - 1][j - 1] + cost[k][i]) {
          pre[i][j] = k;
          dp[i][j] = dp[k - 1][j - 1] + cost[k][i];
        }
      }
    }
  }
  int ret = INF, number;
  for (int i = 1; i <= m; i++)
    if (dp[n][i] < ret) {
      ret = dp[n][i];
      number = i;
    }
  printf("%d\n", ret);
  print(n, number);
}
int main() {
  scanf("%s%d", str + 1, &m);
  work();
  return 0;
}
