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*.

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.
The first line of input contains string *s* containing lowercase English letters (1 ≤ |*s*| ≤ 1000).

The second line contains integer *k* (1 ≤ *k* ≤ 1000).
#include <cstring>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <cstdlib>
#include <string>
#include <set>
#include <sstream>
#include <map>

using namespace std;

string s;
int k;

void no() {
    cout << "NO";
    exit(0);
}

int check(int l, int r) {
//    for(int i = l; i < r; i++)
//        cout << s[i]; cout << endl;
    r--;
    for(;l <= r; l++, r--)
        if (s[l] != s[r]) return 0;
    return 1;
}

int main() {
//#ifndef LOCAL
//    freopen("input.txt", "rt", stdin);
//    freopen("output.txt", "wt", stdout);
//#endif

    cin >> s >> k;
    if (s.size() < k) no();
    if (s.size() % k != 0) no();
    int t = (int)s.size() / k;
    for(int i = 0; i < s.size(); i += t) {
        if (!check(i, i + t))
            no();
    }
    cout << "YES";
    return 0;
}
