#include <bits/stdc++.h>
using namespace std;
const int N = 510;
char str[N];
int cost[N][N];
int dp[N][N];
int pre[N][N];
int n;
void getCost() {
  for (int l = 1; l <= n; l++)
    for (int r = l; r <= n; r++) {
      int cnt = 0;
      for (int i = 0; i < (r - l + 1) / 2; i++)
        if (str[l + i] != str[r - i]) cnt++;
      cost[l][r] = cnt;
    }
}
int main() {
  scanf("%s", str + 1);
  int m;
  cin >> m;
  n = strlen(str + 1);
  getCost();
  memset(dp, 0x3f, sizeof(dp));
  dp[0][0] = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 0; j < i; j++)
      for (int k = 1; k <= m; k++) {
        if (dp[i][k] > dp[j][k - 1] + cost[j + 1][i]) {
          dp[i][k] = dp[j][k - 1] + cost[j + 1][i];
          pre[i][k] = j;
        }
      }
  int ans = 0x3f3f3f3f, k;
  for (int i = 1; i <= m; i++)
    if (dp[n][i] < ans) ans = dp[n][k = i];
  cout << ans << endl;
  vector<int> path;
  for (int i = n; i; i = pre[i][k--]) path.push_back(i);
  reverse(path.begin(), path.end());
  int pre = 0;
  bool first = true;
  for (__typeof((path).begin()) it = (path).begin(); it != (path).end(); it++) {
    if (first)
      first = false;
    else
      printf("+");
    int len = *it - pre;
    for (int i = 0; i < len / 2; i++) str[pre + len - i] = str[pre + i + 1];
    for (int i = pre + 1; i <= *it; i++) {
      putchar(str[i]);
    }
    pre = *it;
  }
  return 0;
}
