#include <bits/stdc++.h>
using namespace std;
const int N = 505;
int dp[N][N];
int build[N][N];
int need[N][N];
char str[N];
string ans;
int n, k;
int solve(int s = 0, int l = k) {
  if (l < 0) return N + N;
  if (s == n) return 0;
  int &ret = dp[s][l];
  if (~ret) return ret;
  ret = N + N;
  for (int i = int(s); i <= int(n - 1); i++) {
    if (ret > need[s][i] + solve(i + 1, l - 1))
      ret = need[s][i] + solve(i + 1, l - 1), build[s][l] = i;
  }
  return ret;
}
void fix(int x, int y) {
  int s = x, e = y;
  while (s < e) str[e--] = str[s++];
  for (int i = int(x); i <= int(y); i++) ans += str[i];
}
int main() {
  scanf("%s%d", str, &k);
  n = strlen(str);
  for (int i = 0; i < int(n); i++)
    for (int j = int(i); j <= int(n - 1); j++) {
      int s = i, e = j;
      while (s < e) {
        if (str[s] != str[e]) need[i][j]++;
        s++, e--;
      }
    }
  memset(dp, -1, sizeof dp);
  printf("%d\n", solve());
  int s = 0, l = k;
  while (s != n) {
    fix(s, build[s][l]);
    s = build[s][l] + 1;
    l--;
    if (s != n) ans += '+';
  }
  cout << ans << endl;
  return 0;
}
