#include <bits/stdc++.h>
using namespace std;
int k;
char s[505];
int dp[505][505];
int last[505][505];
inline int calc(int L, int R) {
  int cnt = 0;
  while (L < R) {
    cnt += s[L] != s[R];
    L++, R--;
  }
  return cnt;
}
string getstr(int L, int R) {
  string ret = "";
  for (int i = L, j = R; i < j; i++, j--) s[j] = s[i];
  for (int i = L; i <= R; i++) ret += s[i];
  return ret;
}
int main(void) {
  scanf("%s%d", s, &k);
  for (int i = 0; s[i]; i++) {
    dp[i][1] = calc(0, i);
    last[i][1] = -1;
    for (int j = 2; j <= k; j++) dp[i][j] = 999;
    for (int j = 1; j <= i; j++) {
      int r = calc(i - j + 1, i);
      for (int l = 2; l <= k; l++) {
        if (dp[i][l] > dp[i - j][l - 1] + r) {
          dp[i][l] = dp[i - j][l - 1] + r;
          last[i][l] = i - j;
        }
      }
    }
  }
  int n = strlen(s);
  int x = min_element(dp[n - 1] + 1, dp[n - 1] + k + 1) - dp[n - 1];
  printf("%d\n", dp[n - 1][x]);
  string ans = "";
  for (int i = x, j = n - 1; i >= 1; --i) {
    ans += (ans == "" ? "" : "+") + getstr(last[j][i] + 1, j);
    j = last[j][i];
  }
  reverse(ans.begin(), ans.end());
  printf("%s\n", ans.c_str());
  return 0;
}
