#include <bits/stdc++.h>
using namespace std;
int dp[550][550];
int pred[550][550];
char s[550];
void PrintPalin(int first, int last) {
  int l = last - first + 1;
  int i;
  for (i = 0; i < l / 2; i++) printf("%c", s[last - i]);
  for (; first + i <= last; i++) printf("%c", s[first + i]);
}
void Print(int l, int kol) {
  int i, j;
  if (kol == 1)
    PrintPalin(0, l - 1);
  else {
    Print(pred[l][kol], kol - 1);
    cout << '+';
    PrintPalin(pred[l][kol], l - 1);
  }
}
int main() {
  int k, i, cur, ll, j, last;
  scanf("%s%d", s, &k);
  int l = strlen(s);
  for (i = 0; i <= l; i++)
    for (j = 0; j <= k; j++) dp[i][j] = 550;
  dp[0][0] = 0;
  for (i = 1; i <= l; i++)
    for (last = 0; last < i; last++) {
      ll = i - last;
      cur = 0;
      for (j = 1; j <= ll / 2; j++)
        if (s[last + j - 1] != s[i - j]) cur++;
      for (j = 0; j < k; j++)
        if (dp[i][j + 1] > dp[last][j] + cur) {
          dp[i][j + 1] = dp[last][j] + cur;
          pred[i][j + 1] = last;
        }
    }
  int mn = 1;
  for (j = 2; j <= k; j++)
    if (dp[l][mn] > dp[l][j]) mn = j;
  cout << dp[l][mn] << endl;
  Print(l, mn);
  cout << endl;
  return 0;
}
