#include <bits/stdc++.h>
using namespace std;
bool palin(char c[], int n) {
  char d[1005], e[1005];
  int i, j;
  for (i = 0, j = n - 1; i < n, j >= 0; i++, j--) {
    e[i] = c[j];
  }
  e[i] = '\0';
  if (strcmp(e, c) == 0) {
    return 1;
  } else {
    return 0;
  }
}
int main() {
  int i, j, k, l, m, n, o, f, t;
  char s[1005], x[1005];
  while (scanf("%s", &s) == 1) {
    scanf("%d", &k);
    l = strlen(s);
    if (l % k != 0) {
      printf("NO\n");
    } else {
      o = l / k;
      t = 0;
      m = 0;
      i = 0;
      f = 0;
      for (; i < l; i++) {
        x[m] = s[i];
        if (m == o - 1) {
          m++;
          x[m] = '\0';
          m--;
          if (palin(x, o) == 0) {
            t = 1;
            break;
          } else {
            m = 0;
            f = 1;
          }
        }
        if (f != 1) {
          m++;
        }
        if (f == 1) {
          f = 0;
        }
      }
      if (t == 1) {
        printf("NO\n");
      } else {
        printf("YES\n");
      }
    }
  }
  return 0;
}

### Prompt

Please formulate a Cpp solution to the following problem:

While Mike was walking in the subway, all the stuff in his back-bag dropped on the ground. There were several fax messages among them. He concatenated these strings in some order and now he has string s.

<image>

He is not sure if this is his own back-bag or someone else's. He remembered that there were exactly k messages in his own bag, each was a palindrome string and all those strings had the same length.

He asked you to help him and tell him if he has worn his own back-bag. Check if the given string s is a concatenation of k palindromes of the same length.

Input

The first line of input contains string s containing lowercase English letters (1 ≤ |s| ≤ 1000).

The second line contains integer k (1 ≤ k ≤ 1000).

Output

Print "YES"(without quotes) if he has worn his own back-bag or "NO"(without quotes) otherwise.

Examples

Input

saba
2


Output

NO


Input

saddastavvat
2


Output

YES

Note

Palindrome is a string reading the same forward and backward.

In the second sample, the faxes in his back-bag can be "saddas" and "tavvat".

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
bool palin(char c[], int n) {
  char d[1005], e[1005];
  int i, j;
  for (i = 0, j = n - 1; i < n, j >= 0; i++, j--) {
    e[i] = c[j];
  }
  e[i] = '\0';
  if (strcmp(e, c) == 0) {
    return 1;
  } else {
    return 0;
  }
}
int main() {
  int i, j, k, l, m, n, o, f, t;
  char s[1005], x[1005];
  while (scanf("%s", &s) == 1) {
    scanf("%d", &k);
    l = strlen(s);
    if (l % k != 0) {
      printf("NO\n");
    } else {
      o = l / k;
      t = 0;
      m = 0;
      i = 0;
      f = 0;
      for (; i < l; i++) {
        x[m] = s[i];
        if (m == o - 1) {
          m++;
          x[m] = '\0';
          m--;
          if (palin(x, o) == 0) {
            t = 1;
            break;
          } else {
            m = 0;
            f = 1;
          }
        }
        if (f != 1) {
          m++;
        }
        if (f == 1) {
          f = 0;
        }
      }
      if (t == 1) {
        printf("NO\n");
      } else {
        printf("YES\n");
      }
    }
  }
  return 0;
}

```