public void solve() throws IOException {
    String input = nextLine();
    int k = nextInt();
    if (input.length() % k != 0) {
      System.out.println("NO");
    } else {
      int len = input.length() / k;
      for (int x = 0; x < k; x++) {
        int start = x * len;
        int end = (x + 1) * len - 1;
        for (int y = 0; y < len / 2; y++) {
          if (input.charAt(start + y) != input.charAt(end - y)) {
            System.out.println("NO");
            return;
          }
        }
      }
      System.out.println("YES");
    }
  }