Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdio.h>
- #include <cmath>
- #include <map>
- #include <set>
- #include <stack>
- #include <queue>
- #include <cstring>
- #include <stdlib.h>
- #include <algorithm>
- #include <iterator>
- #include <vector>
- #include <iomanip>
- /*#define WHITE 1
- #define GRAY 2
- #define BLACK 3*/
- #define SIZE 100001
- #define gcode __gcd
- #define bitcoin __builtin_popcount
- #define check(n, pos) (n & (1<<pos))
- #define set(n, pos) (n | (1<<pos))
- using namespace std;
- vector<string>vec;
- vector<int>vec1;
- vector<char>pb;
- set<int>sett;
- set<int>unknown;
- map<int,int>mp;
- vector<pair<int,int> >vp;
- vector<int>adj[SIZE];
- bool vis[SIZE];
- int a,b;
- int main(){
- //freopen("input","r",stdin);
- string s;
- int n;
- cin>>s;
- cin>>n;
- if(s.length()%n!=0) puts("NO");
- else{
- int diff=s.length()/n;
- for(int i=0;i<s.length();i+=diff){
- for(int j=0;j<diff;j++){
- if(s[i+j]!=s[i+diff-j-1]){ ////pattern-matching algo
- puts("NO");
- exit(0);
- }
- }
- }
- puts("YES");
- }
- //cerr<<"time elapsed:"<<clock()*1000.0/CLOCKS_PER_SEC<<"ms"<<"\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement