#include <bits/stdc++.h>
using namespace std;
const int N = 500;
int cost[N + 1][N + 1];
int dp[N + 1][N + 1];
int pick[N + 1][N + 1];
string s;
int go(int a, int k) {
  int& ret = dp[a][k];
  int& next = pick[a][k];
  if (ret >= 0) return ret;
  if (a == s.size()) return 0;
  if (k == 1) {
    next = s.size();
    return cost[a][s.size()];
  }
  ret = s.size() + 1, next = -1;
  for (int b = a + 1; b <= s.size(); b++) {
    int c = cost[a][b] + go(b, k - 1);
    if (c < ret) ret = c, next = b;
  }
  return ret;
}
void print(int a, int b) {
  if (a > b) return;
  if (a == b) {
    cout << s[a];
    return;
  }
  cout << s[a];
  print(a + 1, b - 1);
  cout << s[a];
}
int main() {
  memset(dp, 0xff, sizeof(dp));
  int k;
  cin >> s >> k;
  for (int l = 2; l <= s.size(); l++)
    for (int a = 0, b = l; b <= s.size(); a++, b++)
      cost[a][b] = ((s[a] == s[b - 1]) ? 0 : 1) + cost[a + 1][b - 1];
  cout << go(0, k) << endl;
  int a = 0;
  while (a != s.size()) {
    if (a != 0) cout << "+";
    int b = pick[a][k];
    print(a, b - 1);
    a = b;
    k--;
  }
  cout << endl;
  return 0;
}
