#include <bits/stdc++.h>
using namespace std;
const int N = 510, inf = 1000000007;
int n, k, m = inf;
char s[N];
int z[N][N], dp[N][N];
int x, d, q, p[N];
void print(int x, int y) {
  for (int i = x; i <= y; i++) printf("%c", min(s[i], s[y + x - i]));
}
int main() {
  scanf("%s %d", s + 1, &k);
  n = strlen(s + 1);
  for (int i = 1; i <= n; i++)
    for (int j = i; j <= n; j++)
      for (int k = i; k <= i + j >> 1; k++)
        if (s[k] != s[j - k + i]) z[i][j]++;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= k; j++) dp[i][j] = inf;
  dp[0][0] = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= k; j++)
      for (int t = 1; t <= i; t++)
        dp[i][j] = min(dp[i][j], dp[t - 1][j - 1] + z[t][i]);
  for (int i = 1; i <= k; i++)
    if (dp[n][i] < m) m = dp[n][i], x = i;
  printf("%d\n", m);
  d = n;
  p[q = 1] = n + 1;
  while (d) {
    int i = d - 1;
    for (; i; i--)
      if (dp[i][x - 1] + z[i + 1][d] == m) break;
    p[++q] = i + 1;
    m -= z[i + 1][d];
    d = i;
    x--;
  }
  for (int i = q; i >= 1; i--) {
    print(p[i], p[i - 1] - 1);
    if (i > 2) printf("+");
  }
  return 0;
}
