#include <bits/stdc++.h>
using namespace std;
template <class T>
int getbit(int i, T X) {
  return (X & (1 << (i - 1)));
}
template <class T>
T onbit(int i, T X) {
  return (X | (1 << (i - 1)));
}
template <class T>
T offbit(int i, T X) {
  return (X | (1 << (i - 1)) - (1 << (i - 1)));
}
template <class T>
T sqr(T x) {
  return (x * x);
}
template <class T>
T cube(T x) {
  return (x * x * x);
}
template <class T>
T gcd(T a, T b) {
  T r;
  while (b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
int csx[4] = {0, 0, -1, 1};
int csy[4] = {-1, 1, 0, 0};
const int MOD = 1000000007;
string s;
int n, k;
void enter() {
  cin >> s;
  n = s.size();
  s = "." + s;
  cin >> k;
}
void solve() {
  if (n % k != 0) {
    cout << "NO";
    return;
  }
  k = n / k;
  for (int i = 1; i <= n;) {
    string cur = "", cur1;
    for (typeof(i + k - 1) j = i; j <= i + k - 1; j++) cur += s[j];
    cur1 = cur;
    reverse(cur1.begin(), cur1.end());
    if (cur1 != cur) {
      cout << "NO";
      return;
    }
    i = i + k;
  }
  cout << "YES";
}
int main() {
  enter();
  solve();
  return 0;
}

### Prompt

Please create a solution in cpp 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;
template <class T>
int getbit(int i, T X) {
  return (X & (1 << (i - 1)));
}
template <class T>
T onbit(int i, T X) {
  return (X | (1 << (i - 1)));
}
template <class T>
T offbit(int i, T X) {
  return (X | (1 << (i - 1)) - (1 << (i - 1)));
}
template <class T>
T sqr(T x) {
  return (x * x);
}
template <class T>
T cube(T x) {
  return (x * x * x);
}
template <class T>
T gcd(T a, T b) {
  T r;
  while (b != 0) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
int csx[4] = {0, 0, -1, 1};
int csy[4] = {-1, 1, 0, 0};
const int MOD = 1000000007;
string s;
int n, k;
void enter() {
  cin >> s;
  n = s.size();
  s = "." + s;
  cin >> k;
}
void solve() {
  if (n % k != 0) {
    cout << "NO";
    return;
  }
  k = n / k;
  for (int i = 1; i <= n;) {
    string cur = "", cur1;
    for (typeof(i + k - 1) j = i; j <= i + k - 1; j++) cur += s[j];
    cur1 = cur;
    reverse(cur1.begin(), cur1.end());
    if (cur1 != cur) {
      cout << "NO";
      return;
    }
    i = i + k;
  }
  cout << "YES";
}
int main() {
  enter();
  solve();
  return 0;
}

```