#include <bits/stdc++.h>
using namespace std;
const int maxint = -1u >> 1;
const int maxn = 500 + 5;
const int inf = 10000;
char s[maxn];
int n, m;
int cost[maxn][maxn], dp[maxn][maxn];
int from[maxn][maxn];
void out(int n, int m) {
  if (n == 0) return;
  int k = from[n][m];
  out(k, m - 1);
  if (k) printf("+");
  for (int st = k + 1, ed = n; st < ed; ++st, --ed) {
    if (s[st] != s[ed]) s[ed] = s[st];
  }
  for (int st = k + 1; st <= n; ++st) printf("%c", s[st]);
}
int main() {
  while (scanf("%s", s + 1) == 1) {
    scanf("%d", &m);
    n = strlen(s + 1);
    for (int i = 1; i <= n; ++i) {
      for (int j = i; j <= n; ++j) {
        int &c = cost[i][j];
        c = 0;
        for (int st = i, ed = j; st < ed; ++st, --ed) {
          if (s[st] != s[ed]) ++c;
        }
      }
    }
    for (int i = 0; i <= n; ++i) {
      for (int j = 0; j <= m; ++j) {
        dp[i][j] = inf;
        from[i][j] = 0;
      }
    }
    dp[0][0] = 0;
    for (int i = 1; i <= n; ++i) {
      for (int j = 1; j <= m; ++j) {
        for (int k = 0; k < i; ++k) {
          if (dp[i][j] > dp[k][j - 1] + cost[k + 1][i]) {
            dp[i][j] = dp[k][j - 1] + cost[k + 1][i];
            from[i][j] = k;
          }
        }
      }
    }
    int am = 1;
    for (int i = 1; i <= m; ++i) {
      if (dp[n][i] < dp[n][am]) am = i;
    }
    m = am;
    printf("%d\n", dp[n][m]);
    out(n, m);
    printf("\n");
  }
  return 0;
}
