#include <bits/stdc++.h>
using namespace std;

int main() {
    int n,s[500005];
    bool flag=0;
    cin>>n;
    for (int i=1; i<=n; i++) cin>>s[i];
    sort(s+1,s+n+1);
    int lo=0,hi=n,mid,ans;
    while (lo<=hi) {
        mid=(lo+hi)/2;
        for (int i=1; i<=mid; i++) {
            if (s[i]*2>=s[n-mid+i-1]) {hi=mid-1; flag=1; }
        }
        if (flag==0) lo=mid+1,ans=mid;
        flag=0;
    }
    cout<<n-ans<<"\n";
}


#include <bits/stdc++.h>
using namespace std;

int main() {
    int n,s[500005];
    cin>>n;
    for (int i=1; i<=n; i++) cin>>s[i];
    sort(s+1,s+n+1);
    int mid=n/2,x=1,mx=n;
    while (x<=mid) {
        if (s[x]*2<=s[n-mid+x]) mx--;
        x++;
    }
    cout<<mx;
}

/*
int main() {
    int n,s[500005];
    bool flag=0;
    cin>>n;
    for (int i=1; i<=n; i++) cin>>s[i];
    sort(s+1,s+n+1);
    int lo=0,hi=n/2,mid,ans;
    while (lo<=hi) {
        mid=lo+(hi-lo+1)/2;  //atau (lo+hi)/2 , (hi-lo+1)/2 +1 to prevent infinite loop (rounding bug)
        for (int i=1; i<=mid; i++) {
            if (s[i]*2>s[n-mid+i]) {hi=mid-1; flag=1; }
        }
        if (flag==0) lo=mid+1,ans=mid;
        flag=0;
    }
    cout<<n-ans<<"\n";
}
*/


#include <bits/stdc++.h>
using namespace std;

int main() {
    int n,s[500005];
    bool flag=0;
    cin>>n;
    for (int i=1; i<=n; i++) cin>>s[i];
    sort(s+1,s+n+1);
    int lo=0,hi=n/2,mid,ans;
    while (lo<=hi) {
        mid=lo+(hi-lo+1)/2;
        for (int i=1; i<=mid; i++) {
            if (s[i]*2>s[n-mid+i]) {hi=mid-1; flag=1; }
        }
        if (flag==0) lo=mid+1,ans=mid;
        flag=0;
    }
    cout<<n-ans<<"\n";
}


#include <bits/stdc++.h>
using namespace std;

int main() {
    int n, cnt = 0;
    cin >> n;
    int s[n+2], l = 1, r = n - ((n + 1)/2) + 1;
    for (int i = 1; i <= n; i++) cin >> s[i];
    sort (s + 1, s + n + 1);
    while (l <= r && r <= n) {
        if (s[l] * 2 <= s[r] && s[r] > 0 ) {
            cnt++;
            l++;
        }
        r++;
    }
    cout << n - cnt <<"\n";
}

/*TLE
int main() {
    int n,s[500005];
    cin>>n;
    for (int i=1; i<=n; i++) cin>>s[i];
    sort(s+1,s+n+1);
    int mid=(n+1)/2,x=1,mx=n;
    while (mid!=n) {
        if (s[x]*2<=s[mid+1]) mx--,x++;
         mid++;
    }
    cout<<mx;
}

int main() {
    int n,s[500005];
    bool flag=0;
    cin>>n;
    for (int i=1; i<=n; i++) cin>>s[i];
    sort(s+1,s+n+1);
    int lo=0,hi=n/2,mid,ans;
    while (lo<=hi) {
        mid=lo+(hi-lo+1)/2;  //atau (lo+hi)/2 , (hi-lo+1)/2 +1 to prevent infinite loop (rounding bug)
        for (int i=1; i<=mid; i++) {
            if (s[i]*2>s[n-mid+i]) {hi=mid-1; flag=1; }
        }
        if (flag==0) lo=mid+1,ans=mid;
        flag=0;
    }
    cout<<n-ans<<"\n";
}
*/


#include <bits/stdc++.h>
using namespace std;

int main() {
    int n,s[500005];
    cin>>n;
    for (int i=1; i<=n; i++) cin>>s[i];
    sort(s+1,s+n+1);
    int mid=n/2,x=1,mx=n;
    while (mid!=n) {
        if (s[x]*2<=s[mid+1]) mx--,x++;
         mid++;
    }
    cout<<mx;
}

/*
int main() {
    int n,s[500005];
    bool flag=0;
    cin>>n;
    for (int i=1; i<=n; i++) cin>>s[i];
    sort(s+1,s+n+1);
    int lo=0,hi=n/2,mid,ans;
    while (lo<=hi) {
        mid=lo+(hi-lo+1)/2;  //atau (lo+hi)/2 , (hi-lo+1)/2 +1 to prevent infinite loop (rounding bug)
        for (int i=1; i<=mid; i++) {
            if (s[i]*2>s[n-mid+i]) {hi=mid-1; flag=1; }
        }
        if (flag==0) lo=mid+1,ans=mid;
        flag=0;
    }
    cout<<n-ans<<"\n";
}
*/


#include <iostream>
#include <cstdio>
#include <algorithm>
const int MAXN = 5000000 + 5;
using namespace std;
string s;
int k;
int main()
{
    while (cin>>s>>k)
    {
        int len = s.length();
        int l = len/k;
        bool flag ;
        if (l*k == len )flag = true;
        if (flag)
        {
            for (int i=0; i<len; i++)
            {
                if (i%l == 0)
                {
                    for (int j=i; j < (i+l)/2; j++)
                    {
                        if (s[i] != s[l-1-i])
                        {
                            flag = false;
                            break;
                        }
                    }
                }
                if (!false) break;
            }
        }

        if (flag)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    return 0;
}
/*
saba
2
saddastavvat
2
abaabaaba
3
ans
3
aaaaaaaaaa
3
*/


#include <iostream>
#include <cstdio>
#include <algorithm>
const int MAXN = 5000000 + 5;
using namespace std;
string s;
int k;
int main()
{
    while (cin>>s>>k)
    {
        int len = s.length();
        int l = len/k;
        bool flag ;
        if (l*k == len )flag = true;
        if (flag)
        {
            for (int i=0; i<len; i+= l)
            {
                if (i%l == 0)
                {
                    for (int j=i; j < i+(l/2); j++)
                    {
                        if (s[j] != s[ 2*i+l-j-1])
                        {
                            flag = false;
                            break;
                        }
                    }
                }
                if (!flag) break;
            }
        }
        if (flag)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    return 0;
}
/*
saba
2
saddastavvat
2
abaabaaba
3
ans
3
aaaaaaaaaa
3
abcaabca
2
aaaaaaaaab
2
*/


#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000 + 5;
string s;
int k,l;
bool parline(string tmp)
{
    for (int i=0; i < l/2; i++)
    {
        if (tmp[i] != tmp[l-1-i]) return false;
    }
    return true;
}
int main()
{
    while (cin>>s>>k)
    {
        int len = s.length();
        l = len/k;
        string str[MAXN];
        int ct = 0;
        bool flag = false;
        if (l == 1) flag = true;
        else
        {
            for (int i=0; i<len; i++)
            {
                str[ct] += s[i];
                if ((i+1) % l == 0)
                {
                    ct++;
                }

            }
            for (int i=0; i < ct; i++)
            {
                flag = parline(str[i]);
                if (!flag) break;
            }
        }
        if (flag)printf("YES\n");
        else  printf("NO\n");
    }
    return 0;
}
/*
saba
2
saddastavvat
2
*/


#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000 + 5;
string s;
int k,l;
bool parline(string tmp)
{
    for (int i=0; i < l/2; i++)
    {
        if (tmp[i] != tmp[l-1-i]) return false;
    }
    return true;
}
int main()
{
    while (cin>>s>>k)
    {
        int len = s.length();
        l = len/k;
        string str[MAXN];
        int ct = 0;
        bool flag = false;
        for (int i=0; i<len; i++)
        {
            str[ct] += s[i];
            if ((i+1) % l == 0)
            {
                ct++;
            }

        }
        for (int i=0; i < ct; i++)
        {
            flag = parline(str[i]);
            if (!flag) break;
        }
        if (flag)printf("YES\n");
        else  printf("NO\n");
    }
    return 0;
}
/*
saba
2
saddastavvat
2
*/


#include <iostream>
#include <cstdio>
#include <algorithm>
const int MAXN = 5000000 + 5;
using namespace std;
string s;
int k;
int main()
{
    while (cin>>s>>k)
    {
        int len = s.length();
        int l = len/k;
        bool flag ;
        if (l*k == len )flag = true;
        if (flag)
        {
            for (int i=0; i<len; i+= l)
            {
                if (i%l == 0)
                {
                    for (int j=i; j < (i+l)/2; j++)
                    {
                        if (s[i] != s[l-1-i])
                        {

                            flag = false;
                            break;
                        }
                    }
                }
                if (!false) break;
            }
        }
        if (flag)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    return 0;
}
/*
saba
2
saddastavvat
2
abaabaaba
3
ans
3
aaaaaaaaaa
3
abcaabca
2
*/


#include <iostream>
#include <cstdio>
#include <algorithm>
const int MAXN = 5000000 + 5;
using namespace std;
string s;
int k;
int main()
{
    while (cin>>s>>k)
    {
        int len = s.length();
        int l = len/k;
        bool flag ;
        if (l*k == len )flag = true;
        if (flag)
        {
            for (int i=0; i<len; i+= l)
            {
                if (i%l == 0)
                {
                    for (int j=i; j < i+(l/2); j++)
                    {
                        if (s[j] != s[l-1-j])
                        {
                            flag = false;
                            break;
                        }
                    }
                }
                if (!flag) break;
            }
        }
        if (flag)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    return 0;
}
/*
saba
2
saddastavvat
2
abaabaaba
3
ans
3
aaaaaaaaaa
3
abcaabca
2
aaaaaaaaab
2
*/


#include <iostream>
#include <cstdio>
#include <algorithm>
const int MAXN = 5000000 + 5;
using namespace std;
string s;
int k;
int main()
{
    while (cin>>s>>k)
    {
        int len = s.length();
        int l = len/k;
        bool flag ;
        if (l*k == len )flag = true;
        if (flag)
        {
            for (int i=0; i<len; i+= l)
            {
                if (i%l == 0)
                {
                    for (int j=i; j < (i+l)/2; j++)
                    {
                        if (s[j] != s[l-1-j])
                        {

                            flag = false;
                            break;
                        }
                    }
                }
                if (!false) break;
            }
        }
        if (flag)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    return 0;
}
/*
saba
2
saddastavvat
2
abaabaaba
3
ans
3
aaaaaaaaaa
3
abcaabca
2
*/


#include <iostream>
#include <cstdio>
#include <algorithm>
const int MAXN = 5000000 + 5;
using namespace std;
string s;
int k;
int main()
{
    while (cin>>s>>k)
    {
        int len = s.length();
        int l = len/k;
        bool flag = true;
        for (int i=0; i<len; i++)
        {
            if (i%l == 0)
            {
                for (int j=i; j < (i+l)/2; j++)
                {
                    if (s[i] != s[l-1-i])
                    {
                        flag = false;
                        break;
                    }
                }
            }
            if (!false) break;
        }
        if (flag)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    return 0;
}
/*
saba
2
saddastavvat
2
abaabaaba
3
ans
3
*/


#include<bits/stdc++.h>
#define ll long long
#define fr first
#define se second
#define pb push_back
#define pf push_front
#define r_0 return 0
#define ld long double
using namespace std;
const ll N = 1e6 +1;
ll n, m , x, a , b,c,k;
string s1, s2,ans;
int main()
{
    cin >> s1 >> n;
    if( s1.size() % 2 != 0 )
    {
        cout << "NO" << endl;
        return 0;
    }
    k = s1.size()/2;
    for( ll i = 0; i < s1.size(); i += k )
    {
        for( ll j = 1; j <= k/2; j ++ )
        {
            if( s1[i + j - 1] != s1[i + k - j] )
            {
                cout << "NO" << endl;
                return 0;
            }
        }
    }
    cout << "YES" << endl;
}


#include<bits/stdc++.h>
#define ll long long
#define fr first
#define se second
#define pb push_back
#define pf push_front
#define r_0 return 0
#define ld long double
using namespace std;
const ll N = 1e6 +1;
ll n, m , x, a , b,c,k;
string s1, s2,ans;
int main()
{
    cin >> s1 >> n;
    if( s1.size() % n != 0 )
    {
        cout << "NO" << endl;
        return 0;
    }
    k = s1.size()/2;
    for( ll i = 0; i < s1.size(); i += k )
    {
        for( ll j = 1; j <= k/2; j ++ )
        {
            if( s1[i + j - 1] != s1[i + k - j] )
            {
                cout << "NO" << endl;
                return 0;
            }
        }
    }
    cout << "YES" << endl;
}


#include<bits/stdc++.h>
#define ll long long
#define fr first
#define se second
#define pb push_back
#define pf push_front
#define r_0 return 0
#define ld long double
using namespace std;
const ll N = 1e6 +1;
ll n, m, i, x, a , b,c,k;
string s1, s2,ans;
int main()
{
    cin >> s1 >> n;
    if( n == 1 )
    {
        s2 = s1;
        reverse( s2.begin(), s2.end() );
        if( s2 == s1 )
        {
            cout << "YES" << endl;
        }
        else
            cout << "NO" << endl;
        return 0;
    }
    if( s1.size() % n != 0 )
    {
        cout << "NO" << endl;
        return 0;
    }
    k = s1.size()/n;
    for( i = 0; i < s1.size(); i += k )
    {
        for( ll j = 1; j <= k/2; j ++ )
        {
            if( s1[i + j - 1] != s1[i + k - j] )
            {
                cout << "NO" << endl;
                return 0;
            }
        }
    }
    cout << "YES" << endl;
}


#include<bits/stdc++.h>
#define ll long long
#define fr first
#define se second
#define pb push_back
#define pf push_front
#define r_0 return 0
#define ld long double
using namespace std;
const ll N = 1e6 +1;
ll n, m , x, a , b,c,k;
string s1, s2,ans;
int main()
{
    cin >> s1 >> n;
    if( n == 1 )
    {

    }
    if( s1.size() % 2 != 0 )
    {
        cout << "NO" << endl;
        return 0;
    }
    k = s1.size()/2;
    for( ll i = 0; i < s1.size(); i += k )
    {
        for( ll j = 1; j <= k/2; j ++ )
        {
            if( s1[i + j - 1] != s1[i + k - j] )
            {
                cout << "NO" << endl;
                return 0;
            }
        }
    }
    cout << "YES" << endl;
}


#include<bits/stdc++.h>
#define ll long long
#define fr first
#define se second
#define pb push_back
#define pf push_front
#define r_0 return 0
#define ld long double
using namespace std;
const ll N = 1e6 +1;
ll n, m, i, x, a , b,c,k;
string s1, s2,ans;
int main()
{
    cin >> s1 >> n;
    if( n == 1 )
    {
        s2 = s1;
        reverse( s2.begin(), s2.end() );
        if( s2 == s1 )
        {
            cout << "YES" << endl;
        }
        else
            cout << "NO" << endl;
        return 0;
    }
    if( s1.size() % n != 0 )
    {
        cout << "NO" << endl;
        return 0;
    }
    k = s1.size()/2;
    for( i = 0; i < s1.size(); i += k )
    {
        for( ll j = 1; j <= k/2; j ++ )
        {
            if( s1[i + j - 1] != s1[i + k - j] )
            {
                cout << "NO" << endl;
                return 0;
            }
        }
    }
    cout << "YES" << endl;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
typedef long long LL;
#define INF 0x3fffffff
using namespace std;

char s[10000];
int n;
int main()
{
   // freopen("/Users/Gavin/Desktop/test.txt", "r", stdin);
    scanf("%s",s);
    int len = strlen(s);
    scanf("%d",&n);
    n=len/n;
    bool ok = true;
    for (int i = 0; i<(len/n); i++) {
        for (int j = 0; j < n/2 +1; j++) {
            //printf("check %d  %c %d %c\n",i*n+j,s[i*n+j],(i+1)*n-j,s[(i+1)*n-j-1]);
            if (s[i*n+j]!=s[(i+1)*n-j-1]) {
                cout<<"NO\n";
                return 0;
            }
        }
    }
    cout<<"YES\n";
    return 0;
    return 0;
}


#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
using namespace std;

const int mod= 258280327;

#define MAXN 9999
#define MAXSIZE 10
#define DLEN 4

class BigNum
{
private:
    int a[500];    //���Կ��ƴ�����λ��
    int len;       //��������
public:
    BigNum(){ len = 1;memset(a,0,sizeof(a)); }   //���캯��
    BigNum(const int);       //��һ��int���͵ı���ת��Ϊ����
    BigNum(const char*);     //��һ���ַ������͵ı���ת��Ϊ����
    BigNum(const BigNum &);  //�������캯��
    BigNum &operator=(const BigNum &);   //���ظ�ֵ�����������֮����и�ֵ����

    friend istream& operator>>(istream&,  BigNum&);   //�������������
    friend ostream& operator<<(ostream&,  BigNum&);   //������������

    BigNum operator+(const BigNum &) const;   //���ؼӷ����������������֮����������
    BigNum operator-(const BigNum &) const;   //���ؼ������������������֮����������
    BigNum operator*(const BigNum &) const;   //���س˷����������������֮����������
    BigNum operator/(const int   &) const;    //���س����������������һ�����������������

    BigNum operator^(const int  &) const;    //������n�η�����
    int    operator%(const int  &) const;    //������һ��int���͵ı�������ȡģ����
    bool   operator>(const BigNum & T)const;   //��������һ�������Ĵ�С�Ƚ�
    bool   operator<(const BigNum & T) const;
    bool   operator==(const BigNum & T) const;
    bool   operator>(const int & t)const;      //������һ��int���͵ı����Ĵ�С�Ƚ�
    bool   operator<(const int &t) const;
    bool   operator==(const int &t) const;

    void print();       //�������
};

bool BigNum::operator==(const BigNum & T) const {
    return !(*this > T) && !(T > *this);
}
bool BigNum::operator==(const int &t) const {
    BigNum T = BigNum(t);
    return *this == T;
}
bool BigNum::operator<(const BigNum & T) const {
    return T > *this;
}
bool BigNum::operator<(const int &t) const {
    return BigNum(t) > *this;
}
BigNum::BigNum(const int b)     //��һ��int���͵ı���ת��Ϊ����
{
    int c,d = b;
    len = 0;
    memset(a,0,sizeof(a));
    while(d > MAXN)
    {
        c = d - (d / (MAXN + 1)) * (MAXN + 1);
        d = d / (MAXN + 1);
        a[len++] = c;
    }
    a[len++] = d;
}
BigNum::BigNum(const char*s)     //��һ���ַ������͵ı���ת��Ϊ����
{
    int t,k,index,l,i;
    memset(a,0,sizeof(a));
    l=strlen(s);
    len=l/DLEN;
    if(l%DLEN)
        len++;
    index=0;
    for(i=l-1;i>=0;i-=DLEN)
    {
        t=0;
        k=i-DLEN+1;
        if(k<0)
            k=0;
        for(int j=k;j<=i;j++)
            t=t*10+s[j]-'0';
        a[index++]=t;
    }
}
BigNum::BigNum(const BigNum & T) : len(T.len)  //�������캯��
{
    int i;
    memset(a,0,sizeof(a));
    for(i = 0 ; i < len ; i++)
        a[i] = T.a[i];
}
BigNum & BigNum::operator=(const BigNum & n)   //���ظ�ֵ�����������֮����и�ֵ����
{
    int i;
    len = n.len;
    memset(a,0,sizeof(a));
    for(i = 0 ; i < len ; i++)
        a[i] = n.a[i];
    return *this;
}
istream& operator>>(istream & in,  BigNum & b)   //�������������
{
    char ch[MAXSIZE*4];
    int i = -1;
    in>>ch;
    int l=strlen(ch);
    int count=0,sum=0;
    for(i=l-1;i>=0;)
    {
        sum = 0;
        int t=1;
        for(int j=0;j<4&&i>=0;j++,i--,t*=10)
        {
            sum+=(ch[i]-'0')*t;
        }
        b.a[count]=sum;
        count++;
    }
    b.len =count++;
    return in;

}
ostream& operator<<(ostream& out,  BigNum& b)   //������������
{
    int i;
    cout << b.a[b.len - 1];
    for(i = b.len - 2 ; i >= 0 ; i--)
    {
        cout.width(DLEN);
        cout.fill('0');
        cout << b.a[i];
    }
    return out;
}

BigNum BigNum::operator+(const BigNum & T) const   //��������֮����������
{
    BigNum t(*this);
    int i,big;      //λ��
    big = T.len > len ? T.len : len;
    for(i = 0 ; i < big ; i++)
    {
        t.a[i] +=T.a[i];
        if(t.a[i] > MAXN)
        {
            t.a[i + 1]++;
            t.a[i] -=MAXN+1;
        }
    }
    if(t.a[big] != 0)
        t.len = big + 1;
    else
        t.len = big;
    return t;
}
BigNum BigNum::operator-(const BigNum & T) const   //��������֮����������
{
    int i,j,big;
    bool flag;
    BigNum t1,t2;
    if(*this>T)
    {
        t1=*this;
        t2=T;
        flag=0;
    }
    else
    {
        t1=T;
        t2=*this;
        flag=1;
    }
    big=t1.len;
    for(i = 0 ; i < big ; i++)
    {
        if(t1.a[i] < t2.a[i])
        {
            j = i + 1;
            while(t1.a[j] == 0)
                j++;
            t1.a[j--]--;
            while(j > i)
                t1.a[j--] += MAXN;
            t1.a[i] += MAXN + 1 - t2.a[i];
        }
        else
            t1.a[i] -= t2.a[i];
    }
    t1.len = big;
    while(t1.a[t1.len - 1] == 0 && t1.len > 1)
    {
        t1.len--;
        big--;
    }
    if(flag)
        t1.a[big-1]=0-t1.a[big-1];
    return t1;
}

BigNum BigNum::operator*(const BigNum & T) const   //��������֮����������
{
    BigNum ret;
    int i,j,up;
    int temp,temp1;
    for(i = 0 ; i < len ; i++)
    {
        up = 0;
        for(j = 0 ; j < T.len ; j++)
        {
            temp = a[i] * T.a[j] + ret.a[i + j] + up;
            if(temp > MAXN)
            {
                temp1 = temp - temp / (MAXN + 1) * (MAXN + 1);
                up = temp / (MAXN + 1);
                ret.a[i + j] = temp1;
            }
            else
            {
                up = 0;
                ret.a[i + j] = temp;
            }
        }
        if(up != 0)
            ret.a[i + j] = up;
    }
    ret.len = i + j;
    while(ret.a[ret.len - 1] == 0 && ret.len > 1)
        ret.len--;
    return ret;
}
BigNum BigNum::operator/(const int & b) const   //������һ�����������������
{
    BigNum ret;
    int i,down = 0;
    for(i = len - 1 ; i >= 0 ; i--)
    {
        ret.a[i] = (a[i] + down * (MAXN + 1)) / b;
        down = a[i] + down * (MAXN + 1) - ret.a[i] * b;
    }
    ret.len = len;
    while(ret.a[ret.len - 1] == 0 && ret.len > 1)
        ret.len--;
    return ret;
}
int BigNum::operator %(const int & b) const    //������һ��int���͵ı�������ȡģ����
{
    int i,d=0;
    for (i = len-1; i>=0; i--)
    {
        d = ((d * (MAXN+1))% b + a[i])% b;
    }
    return d;
}
BigNum BigNum::operator^(const int & n) const    //������n�η�����
{
    BigNum t,ret(1);
    int i;
    if(n<0)
        exit(-1);
    if(n==0)
        return 1;
    if(n==1)
        return *this;
    int m=n;
    while(m>1)
    {
        t=*this;
        for( i=1;i<<1<=m;i<<=1)
        {
            t=t*t;
        }
        m-=i;
        ret=ret*t;
        if(m==1)
            ret=ret*(*this);
    }
    return ret;
}
bool BigNum::operator>(const BigNum & T) const   //��������һ�������Ĵ�С�Ƚ�
{
    int ln;
    if(len > T.len)
        return true;
    else if(len == T.len)
    {
        ln = len - 1;
        while(a[ln] == T.a[ln] && ln >= 0)
            ln--;
        if(ln >= 0 && a[ln] > T.a[ln])
            return true;
        else
            return false;
    }
    else
        return false;
}
bool BigNum::operator >(const int & t) const    //������һ��int���͵ı����Ĵ�С�Ƚ�
{
    BigNum b(t);
    return *this>b;
}

void BigNum::print()    //�������
{
    int i;
    printf("%d", a[len-1]);
    for (int i = len-2; i >= 0; --i) {
        printf("%04d", a[i]);
    }
    puts("");
}

BigNum x[1010],res,m;

int main(void)
{
    int i,n,T;
    char mm[1005];
    x[0]=0;
    x[1]=x[2]=1;
    for(int i=3;i<=1005;i++)
        x[i]=x[i-1]+x[i-2];
    scanf("%d",&T);
    while(T--){
        scanf("%d",&n);
    //    getchar();
        scanf("%s",mm);

        m=BigNum(mm);

//        m.print();
        for(i=1;i<=1005;i++)
            if(x[i]>m+1)
                break;
        res=m-x[i-2];
        res=res%mod;
        res.print();
    }

}


#include <stdio.h>
#include <string.h>
#include <stack>
#include <queue>

char str[1005];
int len;
int main()
{
    int i,j,k;
    scanf("%s%d",str,&k);

         len = strlen(str);
        if(len%k)
        {
            printf("NO\n");
           return 0;
        }
        int r = len/k,flag = 0;
        for(i = 0; i<len; i+=r)
        {
            for(j=i; j<i+r; j++)
            {
                if(str[j]!=str[(i+r)-1-j+i])
                {
                    flag = 1;
                    break;
                }
            }
            if(flag)
                break;
        }
        if(flag)
            printf("NO\n");
        else
            printf("YES\n");

    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
typedef long long LL;
#define INF 0x3fffffff
using namespace std;

char s[10000];
int n;
int main()
{
   // freopen("/Users/Gavin/Desktop/test.txt", "r", stdin);
    scanf("%s",s);
    int T;
    int len = strlen(s);
    scanf("%d",&T);

    n=len/T;
    if (n*T!=len) {

        cout<<"NO\n";
        return 0;
    }

    bool ok = true;
    for (int i = 0; i<(len/n); i++) {
        for (int j = 0; j < n/2 +1; j++) {
          //  printf("check %d  %c %d %c\n",i*n+j,s[i*n+j],(i+1)*n-j-1,s[(i+1)*n-j-1]);
            if (s[i*n+j]!=s[(i+1)*n-j-1]) {
                cout<<"NO\n";
                return 0;
            }
        }
    }
    cout<<"YES\n";
    return 0;
    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
typedef long long LL;
#define INF 0x3fffffff
using namespace std;

char s[10000];
int n;
int main()
{
   // freopen("/Users/Gavin/Desktop/test.txt", "r", stdin);
    scanf("%s",s);
    int T=0;
    int len = strlen(s);
    scanf("%d",&T);

    n=len/T;
    if (n*T!=len) {

        cout<<"NO\n";
        return 0;
    }

    bool ok = true;
    for (int i = 0; i<(len/n); i++) {
        for (int j = 0; j < n/2 +1; j++) {
          //  printf("check %d  %c %d %c\n",i*n+j,s[i*n+j],(i+1)*n-j-1,s[(i+1)*n-j-1]);
            if (s[i*n+j]!=s[(i+1)*n-j-1]) {
                cout<<"NO\n";
                return 0;
            }
        }
    }
    cout<<"YES\n";
    return 0;
    return 0;
}


#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
typedef long long LL;
#define INF 0x3fffffff
using namespace std;

char s[10000];
int n;
int main()
{
  //  freopen("/Users/Gavin/Desktop/test.txt", "r", stdin);
    scanf("%s",s);
    int T;
    int len = strlen(s);
    scanf("%d",&T);

    n=len/T;
    if (n*T!=len) {

        cout<<"NO\n";
        return 0;
    }

    bool ok = true;
    for (int i = 0; i<(len/n); i++) {
        for (int j = 0; j < n/2 +1; j++) {
            printf("check %d  %c %d %c\n",i*n+j,s[i*n+j],(i+1)*n-j-1,s[(i+1)*n-j-1]);
            if (s[i*n+j]!=s[(i+1)*n-j-1]) {
                cout<<"NO\n";
                return 0;
            }
        }
    }
    cout<<"YES\n";
    return 0;
    return 0;
}


#include<cstdio>
#include<cstring>
using namespace std;

int main()
{
	char str[1010];
	int n;
	scanf("%s%d",str,&n);
	int len = strlen(str);
	int k = len/n;
	char s[n+5][k+5];
	for(int i=0;i<n;i++){
		for(int j=0;j<k;j++){
			s[i][j] = str[i*k+j];
		}
		s[i][k] = '\0';
	}
	int i,j;
	for( i=0;i<n;i++){
		for( j=0;j<k/2;j++){
			if(s[i][j]!=s[i][k-1-j])break;
		}
		if(j!=k/2)break;
	}
	if(i!=n)printf("NO\n");
	else printf("YES\n");
}


#include<cstdio>
#include<cstring>
using namespace std;

int main()
{
	char s[1010];
	int n;
	scanf("%s%d",s,&n);
	int len = strlen(s);
	int freq[26];
	memset(freq,0,sizeof freq);
	for(int i=0;i<len;i++)freq[s[i]-97]++;
	int counter = 0,work;
	if(len%n)printf("NO\n");
	else{
		for(int i=0;i<26;i++){
				if(freq[i]%2)counter++;
			}
		work = len/n;
		if(work%2){
			//~ for(int i=0;i<=26;i++){
				//~ if(freq[i]%2)counter++;
			//~ }
			if(counter>n)printf("NO\n");
			else if(counter==n)printf("YES\n");
			else {
				if((n-counter)%2)printf("NO\n");
				else printf("YES\n");
			}
		}
		else{
			if(counter>0)printf("NO\n");
			else printf("YES");
		}
	}
}


#include<cstdio>
#include<cstring>
using namespace std;

int main()
{
	char str[1010];
	int n;
	scanf("%s%d",str,&n);
	int len = strlen(str);
	int k = len/n;
	if(len%n){
		printf("NO\n");
		return 0;
	}
	char s[n+5][k+5];
	for(int i=0;i<n;i++){
		for(int j=0;j<k;j++){
			s[i][j] = str[i*k+j];
		}
		s[i][k] = '\0';
	}
	int i,j;
	for( i=0;i<n;i++){
		for( j=0;j<k/2;j++){
			if(s[i][j]!=s[i][k-1-j])break;
		}
		if(j!=k/2)break;
	}
	if(i!=n)printf("NO\n");
	else printf("YES\n");
}


#include<cstdio>
#include<cstring>
using namespace std;

int main()
{
	char s[1010];
	int n;
	scanf("%s%d",s,&n);
	int len = strlen(s);
	int freq[26];
	memset(freq,0,sizeof freq);
	for(int i=0;i<len;i++)freq[s[i]-97]++;
	int counter = 0,work;
	if(len%n)printf("NO\n");
	else{
		for(int i=0;i<26;i++){
				if(freq[i]%2)counter++;
			}
		work = len/n;
		if(work%2){
			//~ for(int i=0;i<=26;i++){
				//~ if(freq[i]%2)counter++;
			//~ }
			if(counter>n)printf("NO\n");
			else if(counter==n){
				int i;
				for(i=0;i<26;i++){
					if(freq[i]%2==0)continue;
					else if(freq[i]>work){
						printf("NO\n");
						break;
					}
				}
				if(i==26)printf("YES\n");
			}
			else {
				int temp = 0;
				for(int i=0;i<26;i++){
					if(freq[i]%2)temp+=freq[i];
				}
				if((len-temp)%2)printf("NO\n");
				else printf("YES\n");
			}
		}
		else{
			if(counter>0)printf("NO\n");
			else printf("YES");
		}
	}
}


#include<cstdio>
#include<cstring>
using namespace std;

int main()
{
	char s[1010];
	int n;
	scanf("%s%d",s,&n);
	int len = strlen(s);
	int freq[26];
	memset(freq,0,sizeof freq);
	for(int i=0;i<len;i++)freq[s[i]-97]++;
	int counter = 0,work;
	if(len%n)printf("NO\n");
	else{
		for(int i=0;i<=26;i++){
				if(freq[i]%2)counter++;
			}
		work = len/n;
		if(work%2){
			//~ for(int i=0;i<=26;i++){
				//~ if(freq[i]%2)counter++;
			//~ }
			if(counter==work)printf("YES\n");
			else printf("NO\n");
		}
		else{
			if(counter>0)printf("NO\n");
			else printf("YES");
		}
	}
}


#include<cstdio>
#include<cstring>
using namespace std;

int main()
{
	char s[1010];
	int n;
	scanf("%s%d",s,&n);
	int len = strlen(s);
	int freq[26];
	memset(freq,0,sizeof freq);
	for(int i=0;i<len;i++)freq[s[i]-97]++;
	int counter = 0,work;
	if(len%n)printf("NO\n");
	else{
		for(int i=0;i<26;i++){
				if(freq[i]%2)counter++;
			}
		work = len/n;
		if(work%2){
			//~ for(int i=0;i<=26;i++){
				//~ if(freq[i]%2)counter++;
			//~ }
			if(counter==n)printf("YES\n");
			else printf("NO\n");
		}
		else{
			if(counter>0)printf("NO\n");
			else printf("YES");
		}
	}
}


#include<cstdio>
#include<cstring>
using namespace std;

int main()
{
	char s[1010];
	int n;
	scanf("%s%d",s,&n);
	int len = strlen(s);
	int freq[26];
	memset(freq,0,sizeof freq);
	for(int i=0;i<len;i++)freq[s[i]-97]++;
	int counter = 0,work;
	if(len%n)printf("NO\n");
	else{
		for(int i=0;i<26;i++){
				if(freq[i]%2)counter++;
			}
		work = len/n;
		if(work%2){
			//~ for(int i=0;i<=26;i++){
				//~ if(freq[i]%2)counter++;
			//~ }
			if(counter==work)printf("YES\n");
			else printf("NO\n");
		}
		else{
			if(counter>0)printf("NO\n");
			else printf("YES");
		}
	}
}


#include<cstdio>
#include<cstring>
using namespace std;

int main()
{
	char s[1010];
	int n;
	scanf("%s%d",s,&n);
	int len = strlen(s);
	int freq[26];
	memset(freq,0,sizeof freq);
	for(int i=0;i<len;i++)freq[s[i]-97]++;
	int counter = 0,work;
	if(len%n)printf("NO\n");
	else{
		for(int i=0;i<26;i++){
				if(freq[i]%2)counter++;
			}
		work = len/n;
		if(work%2){
			//~ for(int i=0;i<=26;i++){
				//~ if(freq[i]%2)counter++;
			//~ }
			if(counter>n)printf("NO\n");
			else if(counter==n){
				int i;
				for(i=0;i<26;i++){
					if(freq[i]%2==0)continue;
					else if(freq[i]>work){
						printf("NO\n");
						break;
					}
				}
				if(i==26)printf("YES\n");
			}
			else {
				int temp = 0;
				for(int i=0;i<26;i++){
					if(freq[i]%2)temp += (freq[i]+(work-(freq[i]%work))%work);
				}
				if(temp>len)printf("NO\n");
				else printf("YES\n");
			}
		}
		else{
			if(counter>0)printf("NO\n");
			else printf("YES");
		}
	}
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
main(){
    str a;
    cin>>a;
    ll n;
    cin>>n;
    ll len=a.length();
    if(len % n != 0) return cout<<"NO",0;
    ll temp = len / n;
    for(ll i = 0; i < len; i++){
        for(ll j = 0; j < temp/2; j++){
            if(a[i*temp + j] != a[(i+1)*temp - j - 1]) return cout<<"NO";
        }
    }
    puts("YES");
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
main(){
    str a;
    cin>>a;
    ll n;
    cin>>n;
    ll len=a.length();
    if(len % n != 0) return cout<<"NO",0;
    ll temp = len / n;
    for(ll i = 0; i < len; i++){
        for(ll j = 0; j < temp/2; j++){
            if(a[i*temp + j] != a[(i+1)*temp - j - 1]) return cout<<"NO",0;
            i += temp;
        }
    }
    puts("YES");
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
main(){
    str a;
    cin>>a;
    ll n;
    cin>>n;
    ll len=a.length();
    if(len % n != 0) return cout<<"NO",0;
    ll temp = len / n;
    for(ll i = 0; i < len; i++){
        for(ll j = 0; j < temp/2; j++){
            if(a[i*temp + j] != a[(i+1)*temp - j - 1]) return cout<<"NO",0;
        }
    }
    puts("YES");
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
main(){
    str a;
    cin>>a;
    ll n;
    cin>>n;
    ll len=a.length();
    if(len % n != 0) return cout<<"NO",0;
    ll temp = len / n;
    for(ll i = 0; i < len; i++){
        for(ll j = 0; j < temp/2; j++){
            if(a[i*temp + j] != a[(i+1)*temp - j - 1]) return cout<<"NO";
            i += temp;
        }
    }
    puts("YES");
}


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
main(){
    str a;
    cin>>a;
    ll n;
    cin>>n;
    ll len=a.length();
    if(len % n != 0) return cout<<"NO",0;
    ll temp = len / n;
    for(ll i = 0; i < n; i++){
        for(ll j = 0; j < temp/2; j++){
            if(a[i*temp + j] != a[(i+1)*temp - j - 1]) return cout<<"NO",0;
        }
    }
    puts("YES");
}


#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
#include<math.h>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<bitset>
#include<utility>
#include<iterator>
#include<iomanip>
#include<stdlib.h>
#include<numeric>
#include<sstream>
#include<fstream>

using namespace std;

#define R_(s)        freopen(s, "r", stdin)
#define W_(s)        freopen(s, "w", stdout)
#define R_W          R_("input.txt"),W_("output.txt")

#define all(v)             v.begin(),v.end()
#define sz(v)            ((int)((v).size()))
#define psh(x)                  push_back(x)
#define sc(x)                 scanf("%d",&x)

#define rep(i, v)       for(int i=0;i<sz(v);++i)
#define lop(i,n)        for(int i=0;i<n;++i)
#define lop1(i,n)       for(int i=1;i<=n;i++)
#define loop(i,l,r)     for(int i=l;i<r;++i)

#define isodd(x) (x&1)
#define iseven(x) (!(x&1))

#define PI           acos(-1)
#define INF             1<<30
const int mod = 1000000007;

typedef string            ss;
typedef long long int    ll;
typedef pair <int, int>  ii;
typedef pair<ss, int>     si;
typedef pair<int, ss>     is;
typedef pair<char, int>  chi;
typedef pair<ss, ss>     pss;
typedef vector<ii>       vii;
typedef vector<int>       vi;
typedef vector<vi>       vvi;
typedef vector<ss>        vs;
typedef vector<ll>       vll;
typedef vector<vll>     vvll;

ll pw(ll b, ll p){ if (!p) return 1; ll sq = pw(b, p / 2); sq *= sq; if (p % 2) sq *= b; return sq; }
ll gcd(ll a, ll b)  { return (b == 0 ? a : gcd(b, a % b)); }
ll sd(ll x)  { return x<10 ? x : x % 10 + sd(x / 10); }
ll sq(ll x){ lop(i, x)if ((ll)i*i > x) return (i - 1); return ll(1); }
ll lcm(ll a, ll b){ return ((a*b) / gcd(a, b)); }

char C; bool flag = false;
int  n, m = 0, k = 0, ans = 0;
int x = 0, y = 0, z = 0, MAX = 0, MIN = INF; string str, pal, str2;
int a[1000000], b[1000000];

bool IsPalindrome(string s)
{
    for (int i = 0; i < s.size() / 2; i++)
    {
        if (s[i] != s[s.size() - 1 - i]) return false;
    }
    return true;
}

int main()
{
    cin >> str;
    cin >> k;
    n = str.size();
    m = (str.size()+(k-1)) / k;
    for (int i = 0; i < n; i+=m)
    {
        pal = str[i];
        for (int j = i+1; j < i+m; j++)
        {
            pal += str[j];
            if (IsPalindrome(pal))a[pal.size()]++;
        }
    }
    lop(i,1001)
    if (a[i] == k)
    {
        cout << "YES" << endl;
        return 0;
    }
    cout << "NO" << endl;
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
#include<math.h>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<bitset>
#include<utility>
#include<iterator>
#include<iomanip>
#include<stdlib.h>
#include<numeric>
#include<sstream>
#include<fstream>

using namespace std;

#define R_(s)        freopen(s, "r", stdin)
#define W_(s)        freopen(s, "w", stdout)
#define R_W          R_("input.txt"),W_("output.txt")

#define all(v)             v.begin(),v.end()
#define sz(v)            ((int)((v).size()))
#define psh(x)                  push_back(x)
#define sc(x)                 scanf("%d",&x)
#define sc2(x,y)         scanf("%d%d",&x,&y)
#define rep(i, v)       for(int i=0;i<sz(v);++i)
#define lop(i,n)        for(int i=0;i<n;++i)
#define lop1(i,n)       for(int i=1;i<=n;i++)
#define loop(i,l,r)     for(int i=l;i<r;++i)

#define isodd(x) (x&1)
#define iseven(x) (!(x&1))

#define PI           acos(-1)
#define INF             1<<30
const int mod = 1000000007;

typedef string            ss;
typedef long long int    ll;
typedef pair <int, int>  ii;
typedef pair<ss, int>     si;
typedef pair<int, ss>     is;
typedef pair<char, int>  chi;
typedef pair<ss, ss>     pss;
typedef vector<ii>       vii;
typedef vector<int>       vi;
typedef vector<vi>       vvi;
typedef vector<ss>        vs;
typedef vector<ll>       vll;
typedef vector<vll>     vvll;

ll pw(ll b, ll p){ if (!p) return 1; ll sq = pw(b, p / 2); sq *= sq; if (p % 2) sq *= b; return sq; }
ll gcd(ll a, ll b)  { return (b == 0 ? a : gcd(b, a % b)); }
ll sd(ll x)  { return x<10 ? x : x % 10 + sd(x / 10); }
ll sq(ll x){ lop(i, x)if ((ll)i*i > x) return (i - 1); return ll(1); }
ll lcm(ll a, ll b){ return ((a*b) / gcd(a, b)); }

char C; bool flag = false;
int  n, m = 0, k = 0, ans = 0;
int x = 0, y = 0, z = 0, MAX = 0, MIN = INF; string str, str1, str2;
int a[1000000], b[1000000];

bool IsPalindrome(string s)
{
    for (int i = 0; i < s.size() / 2; i++)
    {
        if (s[i] != s[s.size() - 1 - i]) return false;
    }
    return true;
}

int main()
{
    cin >> str; cin >> k;
    n = str.length();
    if (n%k != 0)
    {
        return puts("NO");
    }
    for (int i = 0; i < n; i += n / k)
    {
        if (!IsPalindrome(str.substr(i, n / k)))
        {
            puts("NO");
            return 0;
        }
    }
    puts("YES");
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
#include<math.h>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<bitset>
#include<utility>
#include<iterator>
#include<iomanip>
#include<stdlib.h>
#include<numeric>
#include<sstream>
#include<fstream>

using namespace std;

#define R_(s)        freopen(s, "r", stdin)
#define W_(s)        freopen(s, "w", stdout)
#define R_W          R_("input.txt"),W_("output.txt")

#define all(v)             v.begin(),v.end()
#define sz(v)            ((int)((v).size()))
#define psh(x)                  push_back(x)
#define sc(x)                 scanf("%d",&x)
#define sc2(x,y)         scanf("%d%d",&x,&y)
#define rep(i, v)       for(int i=0;i<sz(v);++i)
#define lop(i,n)        for(int i=0;i<n;++i)
#define lop1(i,n)       for(int i=1;i<=n;i++)
#define loop(i,l,r)     for(int i=l;i<r;++i)

#define isodd(x) (x&1)
#define iseven(x) (!(x&1))

#define PI           acos(-1)
#define INF             1<<30
const int mod = 1000000007;

typedef string            ss;
typedef long long int    ll;
typedef pair <int, int>  ii;
typedef pair<ss, int>     si;
typedef pair<int, ss>     is;
typedef pair<char, int>  chi;
typedef pair<ss, ss>     pss;
typedef vector<ii>       vii;
typedef vector<int>       vi;
typedef vector<vi>       vvi;
typedef vector<ss>        vs;
typedef vector<ll>       vll;
typedef vector<vll>     vvll;

ll pw(ll b, ll p){ if (!p) return 1; ll sq = pw(b, p / 2); sq *= sq; if (p % 2) sq *= b; return sq; }
ll gcd(ll a, ll b)  { return (b == 0 ? a : gcd(b, a % b)); }
ll sd(ll x)  { return x<10 ? x : x % 10 + sd(x / 10); }
ll sq(ll x){ lop(i, x)if ((ll)i*i > x) return (i - 1); return ll(1); }
ll lcm(ll a, ll b){ return ((a*b) / gcd(a, b)); }

char C; bool flag = false;
int  n, k = 0, ans = 0;
int x = 0, y = 0, z = 0, MAX = 0, MIN = INF; string str, pal, str2;
int a[1000000], b[1000000];

bool IsPalindrome(string s)
{
    for (int i = 0; i < s.size() / 2; i++)
    {
        if (s[i] != s[s.size() - 1 - i]) return false;
    }
    return true;
}

int main()
{
    cin >> str;
    cin >> k;
    vector<string> m;
    for (ll i = 0; i < str.size(); i += ((str.size()+k-1) / k)){

        string s = "";
        loop(j, i, (i + ((str.size() + k - 1) / k)))
            s += str[j];
        m.push_back(s);
    }
    lop(i, m.size())
    {
        if (!(m[i] == string(m[i].rbegin(), m[i].rend())))
            cout << "NO" << endl;
             return 0;
    }
    cout << "YES";
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
#include<math.h>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<bitset>
#include<utility>
#include<iterator>
#include<iomanip>
#include<stdlib.h>
#include<numeric>
#include<sstream>
#include<fstream>

using namespace std;

#define R_(s)        freopen(s, "r", stdin)
#define W_(s)        freopen(s, "w", stdout)
#define R_W          R_("input.txt"),W_("output.txt")

#define all(v)             v.begin(),v.end()
#define sz(v)            ((int)((v).size()))
#define psh(x)                  push_back(x)
#define sc(x)                 scanf("%d",&x)
#define sc2(x,y)         scanf("%d%d",&x,&y)
#define rep(i, v)       for(int i=0;i<sz(v);++i)
#define lop(i,n)        for(int i=0;i<n;++i)
#define lop1(i,n)       for(int i=1;i<=n;i++)
#define loop(i,l,r)     for(int i=l;i<r;++i)

#define isodd(x) (x&1)
#define iseven(x) (!(x&1))

#define PI           acos(-1)
#define INF             1<<30
const int mod = 1000000007;

typedef string            ss;
typedef long long int    ll;
typedef pair <int, int>  ii;
typedef pair<ss, int>     si;
typedef pair<int, ss>     is;
typedef pair<char, int>  chi;
typedef pair<ss, ss>     pss;
typedef vector<ii>       vii;
typedef vector<int>       vi;
typedef vector<vi>       vvi;
typedef vector<ss>        vs;
typedef vector<ll>       vll;
typedef vector<vll>     vvll;

ll pw(ll b, ll p){ if (!p) return 1; ll sq = pw(b, p / 2); sq *= sq; if (p % 2) sq *= b; return sq; }
ll gcd(ll a, ll b)  { return (b == 0 ? a : gcd(b, a % b)); }
ll sd(ll x)  { return x<10 ? x : x % 10 + sd(x / 10); }
ll sq(ll x){ lop(i, x)if ((ll)i*i > x) return (i - 1); return ll(1); }
ll lcm(ll a, ll b){ return ((a*b) / gcd(a, b)); }

char C; bool flag = false;
int  n, k = 0, ans = 0;
int x = 0, y = 0, z = 0, MAX = 0, MIN = INF; string str, pal, str2;
int a[1000000], b[1000000];

bool IsPalindrome(string s)
{
    for (int i = 0; i < s.size() / 2; i++)
    {
        if (s[i] != s[s.size() - 1 - i]) return false;
    }
    return true;
}

int main()
{
    cin >> str;
    cin >> k;
    vector<string> m;
    n = str.size();
    for (ll i = 0; i < str.size(); i += ((n+k-1) / k)){

        string s = "";
        loop(j, i, (i + ((n + k - 1) / k)))
            s += str[j];
        m.push_back(s);
    }
    lop(i, m.size())
    {
        if (!(m[i] == string(m[i].rbegin(), m[i].rend())))
        {
            cout << "NO" << endl;
            return 0;
        }

    }
    cout << "YES";
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
#include<math.h>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<bitset>
#include<utility>
#include<iterator>
#include<iomanip>
#include<stdlib.h>
#include<numeric>
#include<sstream>
#include<fstream>

using namespace std;

#define R_(s)        freopen(s, "r", stdin)
#define W_(s)        freopen(s, "w", stdout)
#define R_W          R_("input.txt"),W_("output.txt")

#define all(v)             v.begin(),v.end()
#define sz(v)            ((int)((v).size()))
#define psh(x)                  push_back(x)
#define sc(x)                 scanf("%d",&x)
#define sc2(x,y)         scanf("%d%d",&x,&y)
#define rep(i, v)       for(int i=0;i<sz(v);++i)
#define lop(i,n)        for(int i=0;i<n;++i)
#define lop1(i,n)       for(int i=1;i<=n;i++)
#define loop(i,l,r)     for(int i=l;i<r;++i)

#define isodd(x) (x&1)
#define iseven(x) (!(x&1))

#define PI           acos(-1)
#define INF             1<<30
const int mod = 1000000007;

typedef string            ss;
typedef long long int    ll;
typedef pair <int, int>  ii;
typedef pair<ss, int>     si;
typedef pair<int, ss>     is;
typedef pair<char, int>  chi;
typedef pair<ss, ss>     pss;
typedef vector<ii>       vii;
typedef vector<int>       vi;
typedef vector<vi>       vvi;
typedef vector<ss>        vs;
typedef vector<ll>       vll;
typedef vector<vll>     vvll;

ll pw(ll b, ll p){ if (!p) return 1; ll sq = pw(b, p / 2); sq *= sq; if (p % 2) sq *= b; return sq; }
ll gcd(ll a, ll b)  { return (b == 0 ? a : gcd(b, a % b)); }
ll sd(ll x)  { return x<10 ? x : x % 10 + sd(x / 10); }
ll sq(ll x){ lop(i, x)if ((ll)i*i > x) return (i - 1); return ll(1); }
ll lcm(ll a, ll b){ return ((a*b) / gcd(a, b)); }

char C; bool flag = false;
int  n, k = 0, ans = 0;
int x = 0, y = 0, z = 0, MAX = 0, MIN = INF; string str, pal, str2;
int a[1000000], b[1000000];

bool IsPalindrome(string s)
{
    for (int i = 0; i < s.size() / 2; i++)
    {
        if (s[i] != s[s.size() - 1 - i]) return false;
    }
    return true;
}

int main()
{
    cin >> str;
    cin >> k;
    vector<string> m;
    for (ll i = 0; i < str.size(); i += (str.size() / k)){

        string s = "";
        loop(j, i, (i + (str.size() / k)))
            s += str[j];
        m.push_back(s);
    }
    lop(i, m.size())
    {
        if (!(m[i] == string(m[i].rbegin(), m[i].rend())))return cout << "NO", 0;
    }
    cout << "YES";
    return false;
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<cstring>
#include<cmath>
#include<math.h>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<bitset>
#include<utility>
#include<iterator>
#include<iomanip>
#include<stdlib.h>
#include<numeric>
#include<sstream>
#include<fstream>

using namespace std;

#define R_(s)        freopen(s, "r", stdin)
#define W_(s)        freopen(s, "w", stdout)
#define R_W          R_("input.txt"),W_("output.txt")

#define all(v)             v.begin(),v.end()
#define sz(v)            ((int)((v).size()))
#define psh(x)                  push_back(x)
#define sc(x)                 scanf("%d",&x)
#define rep(i, v)       for(int i=0;i<sz(v);++i)
#define lop(i,n)        for(int i=0;i<n;++i)
#define lop1(i,n)       for(int i=1;i<=n;i++)
#define loop(i,l,r)     for(int i=l;i<r;++i)

#define isodd(x) (x&1)
#define iseven(x) (!(x&1))

#define PI           acos(-1)
#define INF             1<<30
const int mod = 1000000007;

typedef string            ss;
typedef long long int    ll;
typedef pair <int, int>  ii;
typedef pair<ss, int>     si;
typedef pair<int, ss>     is;
typedef pair<char, int>  chi;
typedef pair<ss, ss>     pss;
typedef vector<ii>       vii;
typedef vector<int>       vi;
typedef vector<vi>       vvi;
typedef vector<ss>        vs;
typedef vector<ll>       vll;
typedef vector<vll>     vvll;

ll pw(ll b, ll p){ if (!p) return 1; ll sq = pw(b, p / 2); sq *= sq; if (p % 2) sq *= b; return sq; }
ll gcd(ll a, ll b)  { return (b == 0 ? a : gcd(b, a % b)); }
ll sd(ll x)  { return x<10 ? x : x % 10 + sd(x / 10); }
ll sq(ll x){ lop(i, x)if ((ll)i*i > x) return (i - 1); return ll(1); }
ll lcm(ll a, ll b){ return ((a*b) / gcd(a, b)); }

char C; bool flag = false;
int  n, m = 0, k = 0, ans = 0;
int x = 0, y = 0, z = 0, MAX = 0, MIN = INF; string str, pal, str2;
int a[1000000], b[1000000];

bool IsPalindrome(string s)
{
    for (int i = 0; i < s.size() / 2; i++)
    {
        if (s[i] != s[s.size() - 1 - i]) return false;
    }
    return true;
}

int main()
{
    cin >> str;
    cin >> k;
    n = str.size();
    m = (str.size()+(k-1)) / k;
    for (int i = 0; i < n; i+=m)
    {
        pal = str[i];
        for (int j = i+1; j < i+m; j++)
        {
            pal += str[j];
            if (IsPalindrome(pal))a[pal.size()]++;
        }
    }
    lop(i,1001)
    if (a[i] >= k)
    {
        cout << "YES" << endl;
        return 0;
    }
    cout << "NO" << endl;
    return 0;
}


#include<bits/stdc++.h>
#define pb push_back
using namespace std;
map<char,int>mp;
int n, ch,hc;
string s;
int main(){
cin >> s >> n;
if ( s.size()%n!=0 or (n==1 and s.size()!=1) ){ cout<<"NO"; return 0; }
for( int i = 0; i < s.size(); i ++ ){
    mp[s[i]]++;
}for( int i = 1; i <= 26; i ++ ){
    if( mp[char(i+96)]!= 0 and mp[char(i+96)]%2 != 0 )hc++;
}
if( (n%2==1 and hc<=s.size()/n))cout<<"YES";
else if( n%2==0 and hc==0 )cout<<"YES";
else cout<<"NO";
}


#include<bits/stdc++.h>
#define pb push_back
using namespace std;
map<char,int>mp;
int n, ch,hc;
string s;
int main(){
cin >> s >> n;
if ( s.size()%n!=0 or (n==1 and s.size()!=1) ){ cout<<"NO"; return 0; }
for( int i = 0; i < s.size(); i ++ ){
    mp[s[i]]++;
}for( int i = 1; i <= 26; i ++ ){
    if( s.size()>20 ){
        if( mp[char(i+96)]!=0 )cout<<mp[i]<<endl;
    }
    if( mp[char(i+96)]!= 0 and mp[char(i+96)]%2 != 0 )hc++;
}
if( (n%2==1 and hc<=s.size()/n))cout<<"YES";
else if( n%2==0 and hc==0 )cout<<"YES";
else cout<<"NO";
}


#include<bits/stdc++.h>
#define pb push_back
using namespace std;
map<char,int>mp;
int n, ch,hc;
string s;
int main(){
cin >> s >> n;
if ( s.size()%n!=0 or n==1 ){ cout<<"NO"; return 0; }
for( int i = 0; i < s.size(); i ++ ){
    mp[s[i]]++;
}for( int i = 1; i <= 26; i ++ ){
    if( mp[char(i+96)]!= 0 and mp[char(i+96)]%2 != 0 )hc++;
}
if( (n%2==1 and hc<=s.size()/n))cout<<"YES";
else if( n%2==0 and hc==0 )cout<<"YES";
else cout<<"NO";
}


#include<bits/stdc++.h>
#define pb push_back
using namespace std;
map<char,int>mp;
int n, ch,hc;
string s;
int main(){
cin >> s >> n;
if ( s.size()%n!=0 ){ cout<<"NO"; return 0; }
for( int i = 0; i < s.size(); i ++ ){
    mp[s[i]]++;
}for( int i = 1; i <= 26; i ++ ){
    if( mp[char(i+96)]!= 0 and mp[char(i+96)]%2 != 0 )hc++;
}
if( (n%2==1 and hc<=s.size()/n))cout<<"YES";
else if( n%2==0 and hc==0 )cout<<"YES";
else cout<<"NO";
}


#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
int n, nc=0, kz;
char a[1005];
vector<char>V,D;
cin >> s >> n;
if( s.size()%n!=0 ){cout<<"NO";return 0;}
for( int i = 0; i < s.size(); i ++ ){
    a[i+1]=s[i];
}
for( int i = 0; i <= s.size(); i+=s.size()/n ){
    nc=i;kz=s.size()/n+i;
    reverse(a+1+nc,a+1+kz);
}
for( int i = 0; i < s.size(); i ++ ){
    if( a[i+1]!=s[i] ){ cout << "NO"; return 0; }
}cout << "YES";
}


#include<bits/stdc++.h>
#define pb push_back
using namespace std;
map<char,int>mp;
int n, ch,hc;
string s;
int main(){
cin >> s >> n;
if ( s.size()%n!=0 ){ cout<<"NO"; return 0; }
for( int i = 0; i < s.size(); i ++ ){
    mp[s[i]]++;
}for( int i = 1; i <= 26; i ++ ){
    if( mp[char(i+96)]!= 0 and mp[char(i+96)]%2 != 0 )hc++;
}
if( (s.size()/n%2==1 and hc<=n))cout<<"YES";
else if( s.size()/n%2==0 and hc==0 )cout<<"YES";
else cout<<"NO";
}


#include<bits/stdc++.h>
#define pb push_back
using namespace std;
int n;
bool flag=0;
string s;
char x[1005];
int main(){
cin >> s >> n;
if( s.size()%n!=0 ){ cout<<"NO";return 0; }
for( int i = 1; i <= s.size()+1; i ++ ){
    if( flag==0 ){
        x[i]=s[i-1];
        if( i%(s.size()/n)==0 ){
            flag=1;reverse(x+1,x+1+s.size()/n);
            i-=s.size()/n-1;
        }
    }
    if( flag==1 ){
        if( x[i]!=s[i-1] ){ cout<<"NO"; return 0; }
        if( i%(s.size()/n)==0 )flag=0;
    }
}
cout<<"YES";
}


#include<bits/stdc++.h>
#define pb push_back
using namespace std;
int n;
bool flag=0;
string s;
char x[1005];
int main(){
cin >> s >> n;
if( s.size()%n!=0 ){ cout<<"NO";return 0; }
for( int i = 1; i <= s.size(); i ++ ){
    if( flag==0 ){
        x[i]=s[i-1];
        if( i%(s.size()/n)==0 ){
            flag=1;reverse(x+1,x+1+s.size()/n);
            i-=s.size()/n-1;
        }
    }
    if( flag==1 ){
        if( x[i]!=s[i-1] ){ cout<<"NO"; return 0; }
        if( i%(s.size()/n)==0 )flag=0;
    }
}
cout<<"YES";
}


#include<bits/stdc++.h>
using namespace std;
int main(){
string s;
int n, nc=0, kz;
char a[100005];
vector<char>V,D;
cin >> s >> n;
if( s.size()%n!=0 ){cout<<"NO";return 0;}
for( int i = 0; i < s.size(); i ++ ){
    a[i+1]=s[i];
}
for( int i = 0; i <= s.size(); i+=s.size()/n ){
    nc=i;kz=s.size()/n+i;
    reverse(a+1+nc,a+1+kz);
}
for( int i = 0; i < s.size(); i ++ ){
    if( a[i+1]!=s[i] ){ cout << "NO"; return 0; }
}cout << "YES";
}


#include<bits/stdc++.h>
#define pb push_back
using namespace std;
map<char,int>mp;
int n, ch,hc;
string s;
int main(){
cin >> s >> n;
if ( s.size()%n!=0 ){ cout<<"NO"; return 0; }
if ( n == 1 ){ cout << "YES"; return 0; }
for( int i = 0; i < s.size(); i ++ ){
    mp[s[i]]++;
}for( int i = 1; i <= 26; i ++ ){
    if( mp[char(i+96)]!= 0 and mp[char(i+96)]%2 != 0 )hc++;
}
if( (n%2==1 and hc<=s.size()/n))cout<<"YES";
else if( n%2==0 and hc==0 )cout<<"YES";
else cout<<"NO";
}


#include<bits/stdc++.h>
#define pb push_back
using namespace std;
map<char,int>mp;
int n, ch,hc;
string s;
int main(){
cin >> s >> n;
if ( s.size()%n!=0 ){ cout<<"NO"; return 0; }
for( int i = 0; i < s.size(); i ++ ){
    mp[s[i]]++;
}for( int i = 1; i <= 26; i ++ ){
    if( mp[char(i+96)]!= 0 and mp[char(i+96)]%2 != 0 )hc++;
}
if( s.size()/n%2==1 and hc<=s.size()/n or s.size()/n%2==0 and hc==0 )cout<<"YES";
else cout<<"NO";
}


// Monjurul Huda Munna
// Daffodil International University

#include <string>
#include <cstring>
#include <cmath>
#include <map>
#include <deque>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <algorithm>

using namespace std;

typedef long long int lld;

#define Max 10000009

string str;

bool check(int n, int m){
    int i, j, k;
    while(n<m){
//        cout << n << " " << m << endl;
        if(str[n] != str[m]) return false;
        n++;
        m--;
    }

    return true;
}

int main(){

//    #ifdef munnapagol
//    freopen("305.txt", "r", stdin);
////    freopen("vomit.txt", "w", stdout);
//    #endif

    int i, j, k, h, test, kase = 0;
    int n;
    cin >> str;
    cin >> n;
    int len = str.length();
    k = len/n;
    j = 0;
    h = k - 1;
    bool yes = true;
    for(i=1 ; i<=n ; i++ ){

        yes = check( j, h);
        if(!yes) break;
        j+=k;
        h+=k;
    }
    if(yes) puts("YES");
    else puts("NO");

    return 0;
}


// Monjurul Huda Munna
// Daffodil International University

#include <string>
#include <cstring>
#include <cmath>
#include <map>
#include <deque>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <algorithm>

using namespace std;

typedef long long int lld;

#define Max 10000009

string str;

bool check(int n, int m){
    int i, j, k;
    while(n<m){
        if(str[n] != str[m]) return false;
        n++;
        m--;
    }

    return true;
}

int main(){

//    #ifdef munnapagol
//    freopen("305.txt", "r", stdin);
////    freopen("vomit.txt", "w", stdout);
//    #endif

    int i, j, k, h, test, kase = 0;
    int n;
    cin >> str;
    cin >> n;
    int len = str.length();
    k = len/n;
    j = 0;
    h = k - 1;
    if(len%n!=0){cout << "NO" << endl; return 0; }
    bool yes = true;
    for(i=1 ; i<=n ; i++ ){

        yes = check( j, h);
        if(!yes) break;
        j+=k;
        h+=k;
    }
    if(yes) puts("YES");
    else puts("NO");

    return 0;
}


// Monjurul Huda Munna
// Daffodil International University

#include <string>
#include <cstring>
#include <cmath>
#include <map>
#include <deque>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <algorithm>

using namespace std;

typedef long long int lld;

#define Max 10000009

string str;

bool check(int n, int m){
    int i, j, k;
    while(n<m){
        if(str[n] != str[m]) return false;
        n++;
        m--;
    }

    return true;
}

int main(){

//    #ifdef munnapagol
//    freopen("305.txt", "r", stdin);
////    freopen("vomit.txt", "w", stdout);
//    #endif

    int i, j, k, h, test, kase = 0;
    int n;
    getline(cin, str);
    cin >> n;
    int len = str.length();
    k = len/n;
    j = 1;
    bool yes = true;
    for(i=1 ; i<=n ; i++ ){
        yes = check( j-1, k-1 );
        if(!yes) break;
        j+=k;
        k+=k;
    }

    if(yes) puts("YES");
    else puts("NO");

    return 0;
}


// Monjurul Huda Munna
// Daffodil International University

#include <string>
#include <cstring>
#include <cmath>
#include <map>
#include <deque>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <algorithm>

using namespace std;

typedef long long int lld;

#define Max 10000009

string str;

bool check(int n, int m){
    int i, j, k;
    while(n<m){
//        cout << n << " " << m << endl;
        if(str[n] != str[m]) return false;
        n++;
        m--;
    }

    return true;
}

int main(){

    #ifdef munnapagol
    freopen("305.txt", "r", stdin);
//    freopen("vomit.txt", "w", stdout);
    #endif

    int i, j, k, h, test, kase = 0;
    int n;
    cin >> str;
    cin >> n;
    int len = str.length();
    k = len/n;
    j = 0;
    h = k - 1;
    bool yes = true;
    for(i=1 ; i<=n ; i++ ){

        yes = check( j, h);
        if(!yes) break;
        j+=k;
        h+=k;
    }
    if(k==1) yes = false;
    if(yes) puts("YES");
    else puts("NO");

    return 0;
}


// Monjurul Huda Munna
// Daffodil International University

#include <string>
#include <cstring>
#include <cmath>
#include <map>
#include <deque>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <algorithm>

using namespace std;

typedef long long int lld;

#define Max 10000009

string str;

bool check(int n, int m){
    int i, j, k;
    while(n<m){
//        cout << n << " " << m << endl;
        if(str[n] != str[m]) return false;
        n++;
        m--;
    }

    return true;
}

int main(){

    #ifdef munnapagol
    freopen("305.txt", "r", stdin);
//    freopen("vomit.txt", "w", stdout);
    #endif

    int i, j, k, h, test, kase = 0;
    int n;
    cin >> str;
    cin >> n;
    int len = str.length();
    k = len/n;
    j = 0;
    h = k-1;
    bool yes = true;
    for(i=1 ; i<=n ; i++ ){

        yes = check( j, h );
        if(!yes) break;
        j+=k;
        h+=k;
    }

    if(yes) puts("YES");
    else puts("NO");

    return 0;
}


// Monjurul Huda Munna
// Daffodil International University

#include <string>
#include <cstring>
#include <cmath>
#include <map>
#include <deque>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <cstdio>
#include <iostream>
#include <cstdlib>
#include <algorithm>

using namespace std;

typedef long long int lld;

#define Max 10000009

string str;

bool check(int n, int m){
    int i, j, k;
    while(n<m){
        if(str[n] != str[m]) return false;
        n++;
        m--;
    }

    return true;
}

int main(){

    #ifdef munnapagol
    freopen("305.txt", "r", stdin);
//    freopen("vomit.txt", "w", stdout);
    #endif

    int i, j, k, h, test, kase = 0;
    int n;
    getline(cin, str);
    cin >> n;
    int len = str.length();
    k = len/n;
    j = 0;
    h = k-1;
    bool yes = true;
    for(i=1 ; i<=n ; i++ ){
        yes = check( j, h );
        if(!yes) break;
        j+=k;
        h+=k;
    }

    if(yes) puts("YES");
    else puts("NO");

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
bool pol(string b)
{    int p=b.size();
    for(int i=0;i<p;i++)
    {
        if(b[i]!=b[p-i-1])
        {
            return false;
        }
    }
    return true;
}
int main()
{
       string s;
       cin>>s;
        int n;
       cin>>n;
       int x=s.size()/n,flag=0;
       if(s.size()%n!=0)
       {
           cout<<"NO"<<"\n";
           return 0;
       }
       for(int i=0;i<s.size();i=i+x)
       {
           string r=s.substr(i,i+x);
           //cout<<r<<" ";
           if(!pol(r))
           {
               flag=1;
               break;
           }
       }
       if(flag==0)
        cout<<"YES"<<"\n";
       else
        cout<<"NO"<<"\n";
}


#include<bits/stdc++.h>
using namespace std;
bool pol(string b)
{    int p=b.size();
    for(int i=0;i<p;i++)
    {
        if(b[i]!=b[p-i-1])
        {
            return false;
        }
    }
    return true;
}
int main()
{
       string s;
       cin>>s;
        int n;
       cin>>n;
       int x=s.size()/n,flag=0;
       for(int i=0;i<s.size();i=i+x)
       {
           string r=s.substr(i,i+x);
           if(!pol(r))
           {
               flag=1;
               break;
           }
       }
       if(flag==0)
        cout<<"YES"<<"\n";
       else
        cout<<"NO"<<"\n";
}


#include<bits/stdc++.h>
using namespace std;
bool pol(string b)
{    long long p=b.size();
    for(int i=0;i<p;i++)
    {
        if(b[i]!=b[p-i-1])
        {
            return false;
        }
    }
    return true;
}
int main()
{
       string s;
       cin>>s;
        long long n;
       cin>>n;
       long long  x=s.size()/n,flag=0;
       if(s.size()%n!=0)
       {
           cout<<"NO"<<"\n";
           return 0;
       }
       for(int i=0;i<s.size();i=i+x)
       {
           string r=s.substr(i,i+x);
           //cout<<r<<" ";
           if(!pol(r))
           {
               flag=1;
               break;
           }
       }
       if(flag==0)
        cout<<"YES"<<"\n";
       else
        cout<<"NO"<<"\n";
}


#include <bits/stdc++.h>
using namespace std;
int main() {
    int k;
    string s;
    cin >> s >> k;
    int n = s.length();
	int len = n / k;
	for (int i = 0; i < n; i++) {
		if (n % k or s[i] != s[(i / len) * len + len - 1 - (i % len)]) {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
bool pol(string b)
{    int p=b.size();
    for(int i=0;i<p;i++)
    {
        if(b[i]!=b[p-i-1])
        {
            return false;
        }
    }
    return true;
}
int main()
{
       string s;
       cin>>s;
        int n;
       cin>>n;
       int x=s.size()/n,flag=0;
       if(s.size()%n!=0)
       {
           cout<<"NO"<<"\n";
           return 0;
       }
       for(int i=0;i<s.size();i=i+x)
       {
           string r=s.substr(i,i+x);
           cout<<r<<" ";
           if(!pol(r))
           {
               flag=1;
               break;
           }
       }
       if(flag==0)
        cout<<"YES"<<"\n";
       else
        cout<<"NO"<<"\n";
}


#include <iostream>
#include<algorithm>
using namespace std;
int c,d,i,n,m,k,j,x,y,z;
string s,s1,s2;
main(){
	cin>>s>>n;
	m=s.size();
	if(m%n || m==1 || n==m){cout<<"NO"; return 0;}
	k=m/n/2;
	for(i=0;i<m;i+=2*k){
		s1=s.substr(i,k); s2=s.substr(i+k,k);
		reverse(s2.begin(),s2.end());
		if(s1!=s2){cout<<"NO"; return 0;}
	}
	cout<<"YES";
}


#include <iostream>
#include<algorithm>
using namespace std;
int c,d,i,n,m,k,j,x,y,z;
string s,s1,s2;
main(){
	cin>>s>>n;
	m=s.size();
	if(m%n ||(m==1 && n!=1) || (n==m && n!=1)){cout<<"NO"; return 0;}
	k=m/n/2;
	for(i=0;i<m;i+=2*k){
		s1=s.substr(i,k); s2=s.substr(i+k,k);
		reverse(s2.begin(),s2.end());
		if(s1!=s2){cout<<"NO"; return 0;}
		x++;
		if(x>m)break;
	}
	cout<<"YES";
}


#include <iostream>
#include<algorithm>
using namespace std;
int c,d,i,n,m,k,j,x,y,z;
string s,s1,s2;
main(){
	cin>>s>>n;
	m=s.size();
	if(m%n){cout<<"NO"; return 0;}
	k=m/n/2;
	for(i=0;i<m;i+=2*k){
		s1=s.substr(i,k); s2=s.substr(i+k,k);
		reverse(s2.begin(),s2.end());
		if(s1!=s2){cout<<"NO"; return 0;}
	}
	cout<<"YES";
}


#include <iostream>
#include<algorithm>
using namespace std;
int c,d,i,n,m,k,j,x,y,z;
string s,s1,s2;
main(){
	cin>>s>>n;
	m=s.size();
	if(m%n ||(m==1 && n!=1) || (n==m && n!=1)){cout<<"NO"; return 0;}
	k=m/n/2;
	for(i=0;i<m;i+=2*k){
		s1=s.substr(i,k*2); s2=s.substr(i,k*2);
		reverse(s2.begin(),s2.end());
		if(s1!=s2){cout<<"NO"; return 0;}
		x++;
		if(x>m)break;
	}
	cout<<"YES";
}


#include <iostream>
#include<algorithm>
using namespace std;
int c,d,i,n,m,k,j,x,y,z;
string s,s1,s2;
main(){
	cin>>s>>n;
	m=s.size();
	if(m%n!=0 ||(m==1 && n!=1)){cout<<"NO"; return 0;}
	k=m/n;
	for(i=0;i<m;i+=k){
		s1=s.substr(i,k); s2=s1;
		reverse(s2.begin(),s2.end());
		if(s1!=s2){cout<<"NO"; return 0;}
	}
	cout<<"YES";
}


#include <iostream>
#include<algorithm>
using namespace std;
int c,d,i,n,m,k,j,x,y,z;
string s,s1,s2;
main(){
	cin>>s>>n;
	m=s.size();
	k=m/n/2;
	for(i=0;i<m;i+=2*k){
		s1=s.substr(i,k); s2=s.substr(i+k,k);
		reverse(s2.begin(),s2.end());
		if(s1!=s2){cout<<"NO"; return 0;}
	}
	cout<<"YES";
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    string str;
    int lower_index,i,j;
    int upper_index;
    int indl_length;
    cin>>str;
    int no_of_words;
    cin>>no_of_words;
    indl_length=str.length()/no_of_words;
    lower_index=0;
    upper_index=indl_length-1;
    while(lower_index!=str.length()){
        for(i=lower_index,j=upper_index;i<j;i++,j--){
            if(str[i]!=str[j]){
                cout<<"NO\n";
                return 0;
            }
        }
        lower_index+=indl_length;
        upper_index+=indl_length;
    }
    cout<<"YES\n";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    string str;
    int lower_index,i,j;
    int upper_index;
    int indl_length;
    cin>>str;
    int no_of_words;
    cin>>no_of_words;
    indl_length=str.length()/no_of_words;
    lower_index=0;
    upper_index=indl_length-1;
    while(lower_index<str.length()){
        for(i=lower_index,j=upper_index;i<j;i++,j--){
            if(str[i]!=str[j]){
                cout<<"NO\n";
                return 0;
            }
        }
        lower_index+=indl_length;
        upper_index+=indl_length;
    }
    cout<<"YES\n";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    string str;
    int lower_index,i,j;
    int upper_index;
    int indl_length;
    cin>>str;
    int no_of_words;
    cin>>no_of_words;
    indl_length=str.length()/no_of_words;
    if(no_of_words*indl_length<str.Length()){
        cout<<"NO\n";
        return 0;
    }
    if(no_of_words>str.length()){
        cout<<"NO\n";
        return 0;
    }

    lower_index=0;
    upper_index=indl_length-1;
    while(lower_index<str.length()){
        for(i=lower_index,j=upper_index;i<j;i++,j--){
            if(str[i]!=str[j]){
                cout<<"NO\n";
                return 0;
            }
        }
        lower_index+=indl_length;
        upper_index+=indl_length;
    }
    cout<<"YES\n";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    string str;
    int lower_index,i,j;
    int upper_index;
    int indl_length;
    cin>>str;
    int no_of_words;
    cin>>no_of_words;
    indl_length=str.length()/no_of_words;
    lower_index=0;
    upper_index=indl_length-1;
    while(lower_index<str.length()){
        for(i=lower_index,j=upper_index;i<j;i++,j--){
            if(str[i]!=str[j]){
                cout<<"NO\n";
                return 0;
            }
        }
        lower_index+=indl_length;
        upper_index+=indl_length;
    }
    cout<<"YES\n";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    string str;
    int lower_index,i,j;
    int upper_index;
    int indl_length;
    cin>>str;
    int no_of_words;
    cin>>no_of_words;
    indl_length=str.length()/no_of_words;
    if(no_of_words*indl_length<str.length()){
        cout<<"NO\n";
        return 0;
    }
    if(no_of_words>str.length()){
        cout<<"NO\n";
        return 0;
    }

    lower_index=0;
    upper_index=indl_length-1;
    while(lower_index<str.length()){
        for(i=lower_index,j=upper_index;i<j;i++,j--){
            if(str[i]!=str[j]){
                cout<<"NO\n";
                return 0;
            }
        }
        lower_index+=indl_length;
        upper_index+=indl_length;
    }
    cout<<"YES\n";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    string str;
    int lower_index,i,j;
    int upper_index;
    int indl_length;
    cin>>str;
    int no_of_words;
    cin>>no_of_words;
    if(no_of_words*k<str.Length()){
        cout<<"NO\n";
        return 0;
    }
    if(no_of_words>str.length()){
        cout<<"NO\n";
        return 0;
    }
    indl_length=str.length()/no_of_words;
    lower_index=0;
    upper_index=indl_length-1;
    while(lower_index<str.length()){
        for(i=lower_index,j=upper_index;i<j;i++,j--){
            if(str[i]!=str[j]){
                cout<<"NO\n";
                return 0;
            }
        }
        lower_index+=indl_length;
        upper_index+=indl_length;
    }
    cout<<"YES\n";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    string str;
    int lower_index,i,j;
    int upper_index;
    int indl_length;
    cin>>str;
    int no_of_words;
    cin>>no_of_words;
    if(no_of_words>str.length()){
        cout<<"NO\n";
        return 0;
    }
    indl_length=str.length()/no_of_words;
    lower_index=0;
    upper_index=indl_length-1;
    while(lower_index<str.length()){
        for(i=lower_index,j=upper_index;i<j;i++,j--){
            if(str[i]!=str[j]){
                cout<<"NO\n";
                return 0;
            }
        }
        lower_index+=indl_length;
        upper_index+=indl_length;
    }
    cout<<"YES\n";
    return 0;
}


#include <bits/stdc++.h>
#define lli long long int
#define sc scanf
#define pr printf
#define pb push_back
#define p_b pop_back
#define fi first
#define se second
#define sq(n) n*n
#define fin freopen( "in.txt", "r", stdin );
#define fout freopen( "out.txt", "w", stdout );
using namespace std;
string s, a, b;
lli k, cnt;
int main()
{
    ios_base::sync_with_stdio(false);
    cin >> s >> k;
    for( int i=0; i<s.size(); i++ ){
        lli j=i+1;
        a.clear(),b.clear();
        a+=s[i];
        b+=s[i];
        do{
            a+=s[j];
            b+=s[j];
            j++;
            reverse(a.begin(),a.end());
            if( a == b ){cnt++;i=j-1;break;}
            else reverse(a.begin(),a.end());
        }while( j < s.size() );
    }
    if( cnt == k )cout << "YES";
    else cout << "NO";
}


#include <bits/stdc++.h>
#define lli long long int
#define sc scanf
#define pr printf
#define pb push_back
#define p_b pop_back
#define fi first
#define se second
#define sq(n) n*n
#define fin freopen( "in.txt", "r", stdin );
#define fout freopen( "out.txt", "w", stdout );
using namespace std;
string s, a, b;
lli k, cnt, lnt;
int main()
{
    ios_base::sync_with_stdio(false);
    cin >> s >> k;
    if( s.size() == 1 ){
        if( k == 1 ){cout << "YES";}
        else cout << "NO";
        return 0;
    }
    if( s.size() % k != 0 ){cout << "NO";return 0;}
    for( int i=0; i<s.size(); i++ ){
        lli j=i+1;
        a.clear(),b.clear();
        a+=s[i];
        b+=s[i];
        do{
            a+=s[j];
            b+=s[j];
            j++;
            reverse(a.begin(),a.end());
            if( a == b ){cnt++;if(j-i != s.size()/k){cout << "NO";return 0;}i=j-1;break;}
            else reverse(a.begin(),a.end());
        }while( j < s.size() );
    }
    if( cnt == k )cout << "YES";
    else cout << "NO";
}


#include <bits/stdc++.h>
#define lli long long int
#define sc scanf
#define pr printf
#define pb push_back
#define p_b pop_back
#define fi first
#define se second
#define sq(n) n*n
#define fin freopen( "in.txt", "r", stdin );
#define fout freopen( "out.txt", "w", stdout );
using namespace std;
string s, a, b;
lli k, cnt, lnt;
int main()
{
    ios_base::sync_with_stdio(false);
    cin >> s >> k;
    if( s.size() == 1 ){
        if( k == 1 ){cout << "YES";}
        else cout << "NO";
        return 0;
    }
    if( s.size() % k != 0 ){cout << "NO";return 0;}
    for( int i=0; i<s.size(); i++ ){
        lli j=i+1;
        a.clear(),b.clear();
        a+=s[i];
        b+=s[i];
        do{
            a+=s[j];
            b+=s[j];
            j++;
            if( j % ( s.size() / k ) == 0 ){
            reverse(a.begin(),a.end());
            if( a == b ){cnt++;i=j-1;break;}
            else {cout << "NO";return 0;};
            }
        }while( j < s.size() );
    }
    if( cnt == k )cout << "YES";
    else cout << "NO";
}


#include <bits/stdc++.h>
#define lli long long int
#define sc scanf
#define pr printf
#define pb push_back
#define p_b pop_back
#define fi first
#define se second
#define sq(n) n*n
#define fin freopen( "in.txt", "r", stdin );
#define fout freopen( "out.txt", "w", stdout );
using namespace std;
string s, a, b;
lli k, cnt, lnt;
int main()
{
    ios_base::sync_with_stdio(false);
    cin >> s >> k;
    if( s.size() == 1 ){
        if( k == 1 ){cout << "YES";}
        else cout << "NO";
        return 0;
    }
    for( int i=0; i<s.size(); i++ ){
        lli j=i+1;
        a.clear(),b.clear();
        a+=s[i];
        b+=s[i];
        do{
            a+=s[j];
            b+=s[j];
            j++;
            reverse(a.begin(),a.end());
            if( a == b ){cnt++;if(!lnt)lnt=j-i;else if(j-i != lnt){cout << "NO";return 0;}i=j-1;break;}
            else reverse(a.begin(),a.end());
        }while( j < s.size() );
    }
    if( cnt == k )cout << "YES";
    else cout << "NO";
}


#include <bits/stdc++.h>
#define lli long long int
#define sc scanf
#define pr printf
#define pb push_back
#define p_b pop_back
#define fi first
#define se second
#define sq(n) n*n
#define fin freopen( "in.txt", "r", stdin );
#define fout freopen( "out.txt", "w", stdout );
using namespace std;
string s, a, b;
lli k, cnt, lnt;
int main()
{
    ios_base::sync_with_stdio(false);
    cin >> s >> k;
    if( s.size() == k ){
        cout << "YES";
        return 0;
    }
    if( s.size() % k != 0 ){cout << "NO";return 0;}
    for( int i=0; i<s.size(); i++ ){
        lli j=i+1;
        a.clear(),b.clear();
        a+=s[i];
        b+=s[i];
        do{
            a+=s[j];
            b+=s[j];
            j++;
            if( j % ( s.size() / k ) == 0 ){
            reverse(a.begin(),a.end());
            if( a == b ){cnt++;i=j-1;break;}
            else {cout << "NO";return 0;};
            }
        }while( j < s.size() );
    }
    if( cnt == k )cout << "YES";
    else cout << "NO";
}


#include <bits/stdc++.h>
#define lli long long int
#define sc scanf
#define pr printf
#define pb push_back
#define p_b pop_back
#define fi first
#define se second
#define sq(n) n*n
#define fin freopen( "in.txt", "r", stdin );
#define fout freopen( "out.txt", "w", stdout );
using namespace std;
string s, a, b;
lli k, cnt, lnt;
int main()
{
    ios_base::sync_with_stdio(false);
    cin >> s >> k;
    for( int i=0; i<s.size(); i++ ){
        lli j=i+1;
        a.clear(),b.clear();
        a+=s[i];
        b+=s[i];
        do{
            a+=s[j];
            b+=s[j];
            j++;
            reverse(a.begin(),a.end());
            if( a == b ){cnt++;if(!lnt)lnt=j-i;else if(j-i != lnt){cout << "NO";return 0;}i=j-1;break;}
            else reverse(a.begin(),a.end());
        }while( j < s.size() );
    }
    if( cnt == k )cout << "YES";
    else cout << "NO";
}


#include <iostream>
#include <string.h>
#include <map>
#include <unordered_map>
#include <utility>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <stack>
#include <queue>
#include <map>
#include <stdio.h>

using namespace std;

#define mem(x, val) memset((x), (val), sizeof(x))
#define FOR(i, a, b) for(int i=int(a); i<int(b); i++)
#define pb push_back
#define mk make_pair

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vii;

int main() {
	unordered_map<char, int> repetitions;
	string s;
	int k;
	cin >> s >> k;
	int stringLength = s.length();
	for (int i = 0; i < stringLength; ++i) {
		repetitions[s[i]]++;
	}
	int repeatedCharacters = 0;
	for (auto &i: repetitions) {
		if (i.second % 2 != 0) {
			++repeatedCharacters;
		}
	}
	if (repeatedCharacters < k && repeatedCharacters != 0) {
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}
	return 0;
}


#include <iostream>
#include <string.h>
#include <map>
#include <unordered_map>
#include <utility>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <stack>
#include <queue>
#include <map>
#include <stdio.h>

using namespace std;

#define mem(x, val) memset((x), (val), sizeof(x))
#define FOR(i, a, b) for(int i=int(a); i<int(b); i++)
#define pb push_back
#define mk make_pair

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vii;

int main() {
	unordered_map<char, int> repetitions;
	string s;
	int k;
	cin >> s >> k;
	int stringLength = s.length();
	if (stringLength % k != 0) {
		cout << "NO" << endl;
	} else {
		stringLength /= k;
		for (int i = 0; i < stringLength; ++i) {
			repetitions[s[i]]++;
		}
		int repeatedCharacters = 0;
		for (auto &i: repetitions) {
			if (i.second % 2 != 0) {
				++repeatedCharacters;
			}
		}
		if (repeatedCharacters == 0 || repeatedCharacters < k) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	}
	return 0;
}


#include <iostream>
#include <string.h>
#include <map>
#include <unordered_map>
#include <utility>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <stack>
#include <queue>
#include <map>
#include <stdio.h>

using namespace std;

#define mem(x, val) memset((x), (val), sizeof(x))
#define FOR(i, a, b) for(int i=int(a); i<int(b); i++)
#define pb push_back
#define mk make_pair

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vii;

int main() {
	unordered_map<char, int> repetitions;
	string s;
	int k;
	cin >> s >> k;
	int stringLength = s.length();
	for (int i = 0; i < stringLength; ++i) {
		repetitions[s[i]]++;
	}
	int repeatedCharacters;
	for (auto &i: repetitions) {
		if (i.second % 2 != 0) {
			++repeatedCharacters;
		}
	}
	if (repeatedCharacters < k) {
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}
	return 0;
}


#include <iostream>
#include <string.h>
#include <map>
#include <unordered_map>
#include <utility>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <stack>
#include <queue>
#include <map>
#include <stdio.h>

using namespace std;

#define mem(x, val) memset((x), (val), sizeof(x))
#define FOR(i, a, b) for(int i=int(a); i<int(b); i++)
#define pb push_back
#define mk make_pair

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vii;

bool isPalindrome(string word) {
	int length = word.length();
	for (int i = 0; i < length/2; ++i) {
		if (word[i] != word[length-i-1]) {
			return false;
		}
	}
	return true;
}

int main() {
	unordered_map<char, int> repetitions;
	bool isAnswer = true;
	string s;
	int k;
	cin >> s >> k;
	int stringLength = s.length();
	if (stringLength == 1) {
		cout << "YES" << endl;
	} else {
		if (stringLength % k != 0) {
			cout << "NO" << endl;
		} else {
			int newLength = stringLength/k;
			for (int i = 0; i < stringLength; i+= newLength) {
				if (!isPalindrome(s.substr(i, newLength))) {
					isAnswer = false;
				}
			}
			if (!isAnswer) {
				cout << "NO" << endl;
			} else {
				cout << "YES" << endl;
			}
			// int newLength = length/ k;
			// for (int i = 0; i < stringLength; ++i) {
			// 	repetitions[s[i]]++;
			// }
			// int repeatedCharacters = 0;
			// for (auto &i: repetitions) {
			// 	if (i.second % 2 != 0) {
			// 		++repeatedCharacters;
			// 	}
			// }
			// if (repeatedCharacters == 0 || repeatedCharacters < k) {
			// 	cout << "YES" << endl;
			// } else {
			// 	cout << "NO" << endl;
			// }
		}
	}
	return 0;
}


#include <iostream>
#include <string.h>
#include <map>
#include <unordered_map>
#include <utility>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <stack>
#include <queue>
#include <map>
#include <stdio.h>

using namespace std;

#define mem(x, val) memset((x), (val), sizeof(x))
#define FOR(i, a, b) for(int i=int(a); i<int(b); i++)
#define pb push_back
#define mk make_pair

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vii;

int main() {
	unordered_map<char, int> repetitions;
	string s;
	int k;
	cin >> s >> k;
	int stringLength = s.length();
	for (int i = 0; i < stringLength; ++i) {
		repetitions[s[i]]++;
	}
	int repeatedCharacters = 0;
	for (auto &i: repetitions) {
		if (i.second % 2 != 0) {
			++repeatedCharacters;
		}
	}
	if (repeatedCharacters < k) {
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}
	return 0;
}


#include <iostream>
#include <string.h>
#include <map>
#include <unordered_map>
#include <utility>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <stack>
#include <queue>
#include <map>
#include <stdio.h>

using namespace std;

#define mem(x, val) memset((x), (val), sizeof(x))
#define FOR(i, a, b) for(int i=int(a); i<int(b); i++)
#define pb push_back
#define mk make_pair

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vii;

int main() {
	unordered_map<char, int> repetitions;
	string s;
	int k;
	cin >> s >> k;
	int stringLength = s.length();
	for (int i = 0; i < stringLength; ++i) {
		repetitions[s[i]]++;
	}
	int repeatedCharacters = 0;
	for (auto &i: repetitions) {
		if (i.second % 2 != 0) {
			++repeatedCharacters;
		}
	}
	if (repeatedCharacters < k || repeatedCharacters == 0) {
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}
	return 0;
}


#include <iostream>
#include <string.h>
#include <map>
#include <unordered_map>
#include <utility>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <stack>
#include <queue>
#include <map>
#include <stdio.h>

using namespace std;

#define mem(x, val) memset((x), (val), sizeof(x))
#define FOR(i, a, b) for(int i=int(a); i<int(b); i++)
#define pb push_back
#define mk make_pair

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vii;

int main() {
	unordered_map<char, int> repetitions;
	string s;
	int k;
	cin >> s >> k;
	int stringLength = s.length();
	if (stringLength == 1) {
		cout << "YES" << endl;
	} else {
		if (stringLength % k != 0) {
			cout << "NO" << endl;
		} else {
			for (int i = 0; i < stringLength; ++i) {
				repetitions[s[i]]++;
			}
			int repeatedCharacters = 0;
			for (auto &i: repetitions) {
				if (i.second % 2 != 0) {
					++repeatedCharacters;
				}
			}
			if (repeatedCharacters == 0 || repeatedCharacters < k) {
				cout << "YES" << endl;
			} else {
				cout << "NO" << endl;
			}
		}
	}
	return 0;
}


#include <iostream>
#include <string.h>
#include <map>
#include <unordered_map>
#include <utility>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <stack>
#include <queue>
#include <map>
#include <stdio.h>

using namespace std;

#define mem(x, val) memset((x), (val), sizeof(x))
#define FOR(i, a, b) for(int i=int(a); i<int(b); i++)
#define pb push_back
#define mk make_pair

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vii;

int main() {
	unordered_map<char, int> repetitions;
	string s;
	int k;
	cin >> s >> k;
	int stringLength = s.length();
	if (stringLength == 1) {
		cout << "YES" << endl;
	} else {
		if (stringLength % k != 0) {
			cout << "NO" << endl;
		} else {
			stringLength /= k;
			for (int i = 0; i < stringLength; ++i) {
				repetitions[s[i]]++;
			}
			int repeatedCharacters = 0;
			for (auto &i: repetitions) {
				if (i.second % 2 != 0) {
					++repeatedCharacters;
				}
			}
			if (repeatedCharacters == 0 || repeatedCharacters < k) {
				cout << "YES" << endl;
			} else {
				cout << "NO" << endl;
			}
		}
	}
	return 0;
}


#include <iostream>
#include <string.h>
#include <map>
#include <unordered_map>
#include <utility>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <stack>
#include <queue>
#include <map>
#include <stdio.h>

using namespace std;

#define mem(x, val) memset((x), (val), sizeof(x))
#define FOR(i, a, b) for(int i=int(a); i<int(b); i++)
#define pb push_back
#define mk make_pair

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vii;

bool isPalindrome(string word) {
	int length = word.length();
	for (int i = 0; i < length/2; ++i) {
		if (word[i] != word[length-i-1]) {
			return false;
		}
	}
	return true;
}

int main() {
	unordered_map<char, int> repetitions;
	bool isAnswer = true;
	string s;
	int k;
	cin >> s >> k;
	int stringLength = s.length();
	if (k == 1) {
		if (isPalindrome(s)) {
			cout << "YES" << endl;
		} else {
			cout << "NO" << endl;
		}
	} else {
		if (stringLength % k != 0 || k > stringLength) {
			cout << "NO" << endl;
		} else {
			int newLength = stringLength/k;
			for (int i = 0; i < stringLength; i+= newLength) {
				if (!isPalindrome(s.substr(i, newLength))) {
					isAnswer = false;
				}
			}
			if (!isAnswer) {
				cout << "NO" << endl;
			} else {
				cout << "YES" << endl;
			}
			// int newLength = length/ k;
			// for (int i = 0; i < stringLength; ++i) {
			// 	repetitions[s[i]]++;
			// }
			// int repeatedCharacters = 0;
			// for (auto &i: repetitions) {
			// 	if (i.second % 2 != 0) {
			// 		++repeatedCharacters;
			// 	}
			// }
			// if (repeatedCharacters == 0 || repeatedCharacters < k) {
			// 	cout << "YES" << endl;
			// } else {
			// 	cout << "NO" << endl;
			// }
		}
	}
	return 0;
}


#include <iostream>
#include <string>

using namespace std;

bool is_palindrome(const string& s, int l, int r)
{
    //cout << "Checking from " << l << " to " << r << endl;

    while (l < r) {
        if (s[l] != s[r]) {
            return false;
        }

        l++, r--;
    }

    return true;
}

int main()
{
    string s;
    cin >> s;

    int k;
    cin >> k;

    int seg_len = s.length() / k;

    if (s.length() % k != 0 || seg_len < 1) {
        cout << "NO" << endl;
        return 0;
    }

    for (int i = 0; i < k; i++) {
        if ( ! is_palindrome(s, i * seg_len, ((i + 1) * seg_len) - 1)) {
            cout << "NO" << endl;
            return 0;
        }
    }

    cout << "YES" << endl;

    return 0;
}


#include <iostream>
#include <sstream>
#include <string>
#include <iomanip>
#include <algorithm>
#include <iterator>
#include <functional>
#include <utility>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <list>
#include <bitset>
#include <map>
#include <cstdio>
#include <cassert>
#include <ctime>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <limits>
#include <memory>
#include <tuple>
#include <set>

using namespace std;

const int N = 1234;
char s[N];

inline bool check(int l, int r) {
  for (int i = l; i < r / 2; ++i) {
    if (s[i] != s[r - i - 1]) {
      return false;
    }
  }
  return true;
}

int main() {
  int k, n;
  scanf("%s%d", s, &k);
  n = (int) strlen(s);
  if (n % k != 0) {
    puts("NO");
    return 0;
  }
  for (int i = 0; i < k; ++i) {
    if ( ! check(i * (n / k), (i + 1) * (n / k))) {
      puts("NO");
      return 0;
    }
  }
  puts("YES");
  return 0;
}


#include <iostream>
#include <sstream>
#include <string>
#include <iomanip>
#include <algorithm>
#include <iterator>
#include <functional>
#include <utility>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <list>
#include <bitset>
#include <map>
#include <cstdio>
#include <cassert>
#include <ctime>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <limits>
#include <memory>
#include <tuple>
#include <set>

using namespace std;

const int N = 1234;
char s[N];

inline bool check(int l, int r) {
  for (int i = l; i < r / 2; ++i) {
    if (s[i] != s[r - i - 1]) {
      return false;
    }
  }
  return true;
}

int main() {
  int k, n;
  scanf("%s%d", s, &k);
  n = (int) strlen(s);
  if (n % k != 0) {
    puts("NO");
    return 0;
  }
  for (int i = 0; i < n / k; ++i) {
    if ( ! check(i * (n / k), (i + 1) * (n / k))) {
      puts("NO");
      return 0;
    }
  }
  puts("YES");
  return 0;
}


#include <iostream>
#include <string>

using namespace std;

bool is_palindrome(const string& s, int l, int r)
{
    //cout << "Checking from " << l << " to " << r << endl;

    while (l < r) {
        if (s[l] != s[r]) {
            return false;
        }

        l++, r--;
    }

    return true;
}

int main()
{
    string s;
    cin >> s;

    int k;
    cin >> k;

    int seg_len = s.length() / k;

    for (int i = 0; i < k; i++) {
        if ( ! is_palindrome(s, i * seg_len, ((i + 1) * seg_len) - 1)) {
            cout << "NO" << endl;
            return 0;
        }
    }

    cout << "YES" << endl;

    return 0;
}


#include <iostream>
#include <sstream>
#include <string>
#include <iomanip>
#include <algorithm>
#include <iterator>
#include <functional>
#include <utility>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <list>
#include <bitset>
#include <map>
#include <cstdio>
#include <cassert>
#include <ctime>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <limits>
#include <memory>
#include <tuple>
#include <set>

using namespace std;

const int N = 1234;
char s[N];

inline bool check(int l, int r) {
  while (l < r) {
    if (s[l] != s[r]) {
      return false;
    }
    ++l, --r;
  }
  return true;
}

int main() {
  int k, n;
  scanf("%s%d", s, &k);
  n = (int) strlen(s);
  if (n % k != 0) {
    puts("NO");
    return 0;
  }
  for (int i = 0; i < k; ++i) {
    if ( ! check(i * (n / k), (i + 1) * (n / k) - 1)) {
      puts("NO");
      return 0;
    }
  }
  puts("YES");
  return 0;
}


#include <iostream>
#include <string>

using namespace std;

bool is_palindrome(const string& s, int l, int r)
{
    //cout << "Checking from " << l << " to " << r << endl;

    while (l < r) {
        if (s[l] != s[r]) {
            return false;
        }

        l++, r--;
    }

    return true;
}

int main()
{
    string s;
    cin >> s;

    int k;
    cin >> k;

    int seg_len = s.length() / k;

    if (seg_len < 1) {
        cout << "NO" << endl;
        return 0;
    }

    for (int i = 0; i < k; i++) {
        if ( ! is_palindrome(s, i * seg_len, ((i + 1) * seg_len) - 1)) {
            cout << "NO" << endl;
            return 0;
        }
    }

    cout << "YES" << endl;

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    string s,temp,temp1;int k;
    cin>>s>>k;
    if(s.length() %2 != 0){
        cout<<"NO";
        return 0;}
    int x=s.length()/k;
    for(int i=0;i<s.length();i++){
        temp = s.substr(i,x);
        temp1=temp;
        reverse(temp1.begin(),temp1.end());
        if(temp1 == temp){
            i+=x-1;x*=2;}
        else{
            cout<<"NO";
            return 0;}
    }
    cout<<"YES";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    string s,temp,temp1;int k;
    cin>>s>>k;
    if(s.length() %2 != 0){
        cout<<"NO";
        return 0;}
    int x=s.length()/k;
    for(int i=0;i<s.length();i++){
        temp = s.substr(i,x);
        temp1=temp;cout<<temp<<endl;
        reverse(temp1.begin(),temp1.end());cout<<temp1<<endl;
        if(temp1 == temp){
            i+=x-1;x*=2;}
        else{
            cout<<"NO";
            return 0;}
    }
    cout<<"YES";
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    string s,s2,s1;
    int k;
    cin>>s>>k;
    s2=s[0];
    if(s.length()%k >0){
         printf("NO");
        return 0;
    }
    for(int i=0;i<s.length();i++){
        if( s[i]==s2[0]){
           s2+=s[i];
           s1=s2;
          reverse(s2.begin(),s2.end());
          if(s2==s1 && k>0){
            k--;s2=s[i+1];i++;
          }
        }
        else s2+=s[i];
    }
    if(k==0) printf("YES");
    else  printf("NO");
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    string s,temp,temp1;int k;
    cin>>s>>k;
    if(s.length()%k != 0){
        cout<<"NO";
        return 0;}
    int x=s.length()/k;
    for(int i=0;i<s.length();i++){
        temp = s.substr(i,x);
        temp1=temp;
        reverse(temp1.begin(),temp1.end());
        if(temp1 == temp){
            i+=x-1;x*=2;}
        else{
            cout<<"NO";
            return 0;}
    }
    cout<<"YES";
    return 0;
}


#include <iostream>
#include<bits/stdc++.h>
using namespace std;

int main()
{   string s , s1 , s2 ; int n , x =0 , v ;cin>>s>>n;
   if(s.size()%n!=0){cout<<"NO";return 0;}
   v=s.size()/n;
   for (int i = 0 ; i < n ; i++){s1= s.substr(x,v);s2 = s1;
     reverse(s1.begin(),s1.end());
    if(s1!=s2){cout<<"NO";return 0;}
    x = x + s.size()/n;
   // v += s.size()/n;
   }
    cout << "YES" << endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int main()
{
    string s,s2,s1;
    int k;
    cin>>s>>k;
    s2=s[0];
    if(s.length()%k >0){
         printf("NO");
        return 0;
    }
    for(int i=1;i<s.length();i++){
        if( s[i]==s2[0]){
           s2+=s[i];
           s1=s2;
          reverse(s2.begin(),s2.end());
          if(s2==s1 && k>0){
            k--;s2=s[i+1];i++;
          }
        }
        else s2+=s[i];
    }
    if(k==0) printf("YES");
    else  printf("NO");
    return 0;
}