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 Rust (1.15.1) (judge verdict: Accepted)

use std::cmp;
use std::collections::BTreeMap;

fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());

    let n: usize = sc.read();
    let k: usize = sc.read();
    let c: usize = sc.read();
    let s = sc.chars();

    let mut left_max = vec![0; n];

    let mut pos = 0;
    let mut cur = 0;
    while pos < n {
        if s[pos] == 'o' {
            pos += c;
            cur += 1;
            if pos < n {
                left_max[pos] = cur;
            }
        }
        pos += 1;
    }
    for i in 1..n {
        left_max[i] = cmp::max(left_max[i - 1], left_max[i]);
    }

    let mut right_max = vec![0; n];
    let mut pos = n - 1;
    let mut cur = 0;
    loop {
        if s[pos] == 'o' {
            cur += 1;
            right_max[pos] = cur;
            if pos >= c {
                pos -= c;
            } else {
                break;
            }
        }
        if pos > 0 {
            pos -= 1;
        } else {
            break;
        }
    }
    for i in (1..n).rev() {
        right_max[i - 1] = cmp::max(right_max[i - 1], right_max[i]);
    }

    let mut map = BTreeMap::new();
    for i in 0..n {
        if s[i] == 'x' {
            continue;
        }

        let prev = if i > 0 { left_max[i - 1] } else { 0 };
        let next = if i + c + 1 < n {
            right_max[i + c + 1]
        } else {
            0
        };
        if prev + next + 1 == k {
            map.entry((prev, next)).or_insert_with(Vec::new).push(i);
        }
    }

    let mut ans: Vec<_> = map
        .values()
        .filter(|t| t.len() == 1)
        .map(|t| t[0])
        .collect();

    ans.sort();
    // println!("{:?}", left_max);
    // println!("{:?}", right_max);
    // println!("{:?}", ans);
    for ans in ans.into_iter() {
        sc.write(ans + 1);
        sc.write("\n");
    }
}

//o oxxox oxxx oxoxx o
//3 33322 2222 21111 1
pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: ToString>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.to_string().as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}