#include <bits/stdc++.h>
using namespace std;
int kcount, change[505][505];
char str[505];
int dp[505][505], par[505][505][2];
int calculate(int idx, int k) {
  if (dp[idx][k] != -1) return dp[idx][k];
  if (idx < 0) return 0;
  if (k == 1) {
    dp[idx][k] = change[0][idx];
    par[idx][k][0] = par[idx][k][1] = -1;
    return dp[idx][k];
  }
  dp[idx][k] = (1 << 25);
  par[idx][k][0] = par[idx][k][1] = -1;
  for (int sidx = idx; sidx >= 0; --sidx) {
    int temp = calculate(sidx - 1, k - 1);
    if (temp + change[sidx][idx] < dp[idx][k]) {
      dp[idx][k] = temp + change[sidx][idx];
      par[idx][k][0] = sidx - 1;
      par[idx][k][1] = k - 1;
    }
  }
  return dp[idx][k];
}
void print_it(int idx, int k) {
  if (par[idx][k][0] >= 0) {
    print_it(par[idx][k][0], par[idx][k][1]);
    putchar('+');
  }
  int i = par[idx][k][0] + 1;
  int j = idx;
  while (i <= j) {
    putchar(str[i]);
    ++i;
    --j;
  }
  while (j >= par[idx][k][0] + 1) {
    putchar(str[j]);
    --j;
  }
}
int main() {
  scanf("%s%d", str, &kcount);
  for (int len = 1; len <= strlen(str); ++len)
    for (int st = 0; st + len - 1 < strlen(str); ++st) {
      if (str[st] == str[st + len - 1]) {
        change[st][st + len - 1] =
            (st + 1 <= st + len - 2) ? change[st + 1][st + len - 2] : 0;
      } else {
        change[st][st + len - 1] =
            ((st + 1 <= st + len - 2) ? change[st + 1][st + len - 2] : 0) + 1;
      }
    }
  memset(dp, -1, sizeof(dp));
  memset(par, -1, sizeof(par));
  printf("%d\n", calculate(strlen(str) - 1, kcount));
  print_it(strlen(str) - 1, kcount);
  putchar('\n');
  return 0;
}
