#include <bits/stdc++.h>
using namespace std;
int k, mem[505][505], mem_cost[505][505];
string s;
int cost(int i, int j) {
  if (i >= j) return 0;
  int& ret = mem_cost[i][j];
  if (~ret) return ret;
  return ret = cost(i + 1, j - 1) + (s[i] != s[j]);
}
int solve(int i = 0, int rem = k - 1) {
  if (i == s.size()) return 0;
  int& ret = mem[i][rem];
  if (~ret) return ret;
  ret = cost(i, s.size() - 1);
  for (int m = i; m < (int)s.size() && rem > 0; ++m)
    ret = min(ret, cost(i, m) + solve(m + 1, rem - 1));
  return ret;
}
void print(int i = 0, int rem = k - 1) {
  if (i == s.size()) return;
  int end_idx = (int)s.size() - 1;
  int cost_pal = cost(i, end_idx);
  for (int m = i; m < (int)s.size() && rem > 0; ++m) {
    if (cost(i, m) + solve(m + 1, rem - 1) < cost_pal) {
      cost_pal = cost(i, m) + solve(m + 1, rem - 1);
      end_idx = m;
    }
  }
  for (int idx = i, l = end_idx; idx < l; idx++, l--) {
    s[l] = s[idx];
  }
  for (int idx = i; idx <= end_idx; idx++) {
    cout << s[idx];
  }
  if (end_idx < (int)s.size() - 1) {
    cout << '+';
    print(end_idx + 1, rem - 1);
  }
  return;
}
int main() {
  memset(mem, -1, sizeof mem);
  memset(mem_cost, -1, sizeof mem_cost);
  cin >> s >> k;
  cout << solve() << endl, print();
  cout << endl;
  return 0;
}
