#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
const int mod = 1000000007;
int dp[510][510], n, memo[510][510], choose[510][510];
char line[510];
int help(int a, int b) {
  int i = a, j = b;
  if (dp[a][b] != -1) return dp[a][b];
  dp[a][b] = 0;
  for (; i < j; i++, j--)
    if (line[i] != line[j]) dp[a][b]++;
  return dp[a][b];
}
int solve(int pos, int k) {
  if (k < 0) return 0x3f3f3f3f;
  if (pos == n) return 0;
  if (memo[pos][k] != -1) return memo[pos][k];
  memo[pos][k] = help(pos, n - 1);
  choose[pos][k] = n - 1;
  if (k) {
    for (int i = pos; i < n - 1; i++)
      if (memo[pos][k] > help(pos, i) + solve(i + 1, k - 1)) {
        memo[pos][k] = help(pos, i) + solve(i + 1, k - 1);
        choose[pos][k] = i;
      }
  }
  return memo[pos][k];
}
void rec(int pos, int k) {
  int q = choose[pos][k];
  for (int i = pos, j = q; i < j; i++, j--) line[j] = line[i];
  for (int i = pos; i <= q; i++) printf("%c", line[i]);
  if (q == n - 1) return;
  printf("+");
  rec(q + 1, k - 1);
  return;
}
int main() {
  int k;
  scanf(" %s", line);
  scanf("%d", &k);
  n = strlen(line);
  k--;
  memset((dp), -1, sizeof(dp));
  memset((memo), -1, sizeof(memo));
  printf("%d\n", solve(0, k));
  rec(0, k);
  printf("\n");
  return 0;
}
