結果
| 問題 | 
                            No.2773 Wake up Record 1
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2025-10-12 19:41:49 | 
| 言語 | Rust  (1.83.0 + proconio)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 499 bytes | 
| コンパイル時間 | 13,676 ms | 
| コンパイル使用メモリ | 397,972 KB | 
| 実行使用メモリ | 7,720 KB | 
| 最終ジャッジ日時 | 2025-10-12 19:42:05 | 
| 合計ジャッジ時間 | 14,521 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 WA * 1 | 
| other | AC * 21 WA * 1 | 
コンパイルメッセージ
warning: unused variable: `n` --> src/main.rs:5:9 | 5 | n: usize, | ^ help: if this is intentional, prefix it with an underscore: `_n` | = note: `#[warn(unused_variables)]` on by default
ソースコード
use proconio::input;
fn main() {
    input! {
        n: usize,
        s: String,
    }
    let chars: Vec<char> = s.chars().collect();
    let ans: Vec<usize> = chars
        .windows(2)
        .enumerate()
        .filter(|(_, w)| w[0] == 'x' && w[1] == 'o')
        .map(|(i, _)| i + 2)
        .collect();
    if ans.is_empty() {
        println!("0");
    } else {
        println!("{}", ans.len());
        for a in ans {
            print!("{a} ");
        }
        println!();
    }
}