Problem:
Score : 500 points

Problem Statement

Takahashi has decided to work on K days of his choice from the N days starting with tomorrow.

You are given an integer C and a string S. Takahashi will choose his workdays as follows:

After working for a day, he will refrain from working on the subsequent C days.

If the i-th character of S is x, he will not work on Day i, where Day 1 is tomorrow, Day 2 is the day after tomorrow, and so on.

Find all days on which Takahashi is bound to work.

Constraints

1 \leq N \leq 2 \times 10^5

1 \leq K \leq N

0 \leq C \leq N

The length of S is N.

Each character of S is o or x.

Takahashi can choose his workdays so that the conditions in Problem Statement are satisfied.

Input

Input is given from Standard Input in the following format:

N K C
S

Output

Print all days on which Takahashi is bound to work in ascending order, one per line.

Sample Input 1

11 3 2
ooxxxoxxxoo

Sample Output 1

6

Takahashi is going to work on 3 days out of the 11 days. After working for a day, he will refrain from working on the subsequent 2 days.

There are four possible choices for his workdays: Day 1,6,10, Day 1,6,11, Day 2,6,10, and Day 2,6,11.

Thus, he is bound to work on Day 6.

Sample Input 2

5 2 3
ooxoo

Sample Output 2

1
5

There is only one possible choice for his workdays: Day 1,5.

Sample Input 3

5 1 0
ooooo

Sample Output 3

There may be no days on which he is bound to work.

Sample Input 4

16 4 3
ooxxoxoxxxoxoxxo

Sample Output 4

11
16

Solution in C++14 (GCC 5.4.1) (judge verdict: Accepted)

#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <cmath>
#include <cstring>
#include <assert.h>
#include <utility>
#include <tuple>
#include <array>
#include <bitset>
#include <cstdlib>

using int64 = long long;
using uint64 = unsigned long long;
using int128 = __int128_t;
using uint128 = __uint128_t;
using float64 = long double;

template <typename T = int>
struct Range {
  struct RangeIterator {
    T i, step;

    RangeIterator(T i, T step) : i{i}, step{step} {}

    T &operator*() { return i; }
    RangeIterator &operator++() {
      i += step;
      return *this;
    }
    bool operator!=(const RangeIterator &rhs) const {
      return (step > 0 && i < rhs.i) || (step < 0 && i > rhs.i);
    }
  };

  T start, stop, step;

  Range(T start, T stop, T step) : start{start}, stop{stop}, step{step} {}
  Range(T start, T stop) : Range(start, stop, 1) {}
  Range(T stop) : Range(0, stop, 1) {}

  RangeIterator begin() const { return RangeIterator{start, step}; }
  RangeIterator end() const { return RangeIterator{stop, step}; }
};

template <typename T>
inline void ChooseMax(T &a, const T &b) {
  a = std::max(a, b);
}

template <typename T>
inline void ChooseMin(T &a, const T &b) {
  a = std::min(a, b);
}

template <typename T>
std::ostream& operator<<(std::ostream& ostr, const std::vector<T>& vec) {
  ostr << "[";
  for (auto itr = vec.begin(); itr != vec.end(); itr++) {
    if (itr != vec.begin()) {
      ostr << ", ";
    }
    ostr << *itr;
  }
  ostr << "]";
  return ostr;
}

template <typename K, typename V>
std::ostream& operator<<(std::ostream& ostr, const std::map<K, V>& map) {
  ostr << "{";
  for (auto itr = map.begin(); itr != map.end(); itr++) {
    if (itr != map.begin()) {
      ostr << ", ";
    }
    ostr << itr->first << " => " << itr->second;
  }
  ostr << "}";
  return ostr;
}

template <typename T>
std::ostream& operator<<(std::ostream& ostr, const std::set<T>& set) {
  ostr << "{";
  for (auto itr = set.begin(); itr != set.end(); itr++) {
    if (itr != set.begin()) {
      ostr << ", ";
    }
    ostr << *itr;
  }
  ostr << "}";
  return ostr;
}

template <typename F, typename S>
std::ostream& operator<<(std::ostream& ostr, const std::pair<F, S>& pair) {
  ostr << "(" << pair.first << ", " << pair.second << ")";
  return ostr;
}

void SolveProblem() {
  int n, k, c;
  std::cin >> n >> k >> c;
  std::string s;
  std::cin >> s;

  std::vector<int> dp_l(n, 0), dp_r(n, 0), cumsum(n + 1, 0);
  std::vector<int> table(n + 1, 0);
  for (int i = n - 1; i >= 0; i--) {
    if (s[i] == 'o') {
      int64 val = (i + c + 1 < n) ? dp_r[i + c + 1] : 0;
      dp_r[i] = val + 1;
    } else if (i + 1 < n) {
      dp_r[i] = dp_r[i + 1];
    }
    table[dp_r[i]] = std::max(table[dp_r[i]], i);
  }

  for (int i = 0; i < n; i++) {
    if (s[i] == 'o') {
      int64 val = (i - c - 1 >= 0) ? dp_l[i - c - 1] : 0;
      dp_l[i] = val + 1;
    } else if (i - 1 >= 0) {
      dp_l[i] = dp_l[i - 1];
    }
  }

  for (int i = 0; i < n; i++) {
    if (dp_r[i] >= k) {
      cumsum[0]++;
      cumsum[i]--;
    }
    if (dp_l[i] >= k) {
      cumsum[i + 1]++;
      cumsum[n]--;
    } else {
      if (table[k - dp_l[i]] > i + c) {
        cumsum[i + 1]++;
        cumsum[table[k - dp_l[i]]]--;
      }
    }
  }

  // std::cerr << "table " << table[1] << std::endl;

  for (int i = 0; i < n; i++) {
    if (i > 0) {
      cumsum[i] += cumsum[i - 1];
    }
    // std::cerr << i + 1 << " " << s[i] << " day: " << cumsum[i] << std::endl;
    // std::cerr << "dp_l: " << dp_l[i] << std::endl;
    if (s[i] == 'o' && cumsum[i] == 0) {
      std::cout << i + 1 << std::endl;
    }
  }

}

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  std::cout.setf(std::ios::fixed);
  std::cout.precision(10);

  SolveProblem();

  return 0;
}