#include <bits/stdc++.h>
int dp[505][505];
int vis[505][505];
int tran[505][505];
char str[505];
int c[505][505];
int f(int n, int m) {
  if (m < 0) return 505;
  if (vis[n][m]) return dp[n][m];
  int ans = 505, ansi = -1;
  for (int i = 1; i <= n; i++) {
    int cost = f(i - 1, m - 1) + c[i][n];
    if (cost < ans) ans = cost, ansi = i - 1;
  }
  tran[n][m] = ansi;
  dp[n][m] = ans;
  vis[n][m] = 1;
  return ans;
}
void tr(int n, int m) {
  if (n == 0) return;
  int pre = tran[n][m];
  tr(pre, m - 1);
  if (pre != 0) printf("+");
  int l = pre + 1, r = n;
  while (l <= r) {
    if (str[l] != str[r]) str[r] = str[l];
    l++, r--;
  }
  for (int i = pre + 1; i <= n; i++) {
    printf("%c", str[i]);
  }
}
int main() {
  for (int i = 0; i < 505; i++) dp[0][i] = 0, vis[0][i] = 1;
  str[0] = ' ';
  gets(str + 1);
  int n = strlen(str);
  int m;
  scanf("%d", &m);
  for (int i = 1; i < n; i++)
    for (int j = i; j < n; j++) {
      int l = i, r = j;
      int t = 0;
      while (l <= r) {
        if (str[l] != str[r]) t++;
        l++, r--;
      }
      c[i][j] = t;
    }
  int ans = f(n - 1, m);
  printf("%d\n", ans);
  tr(n - 1, m);
}
