Rust translated, 8ms, 100%
rust\nimpl Solution {\n    pub fn get_max_repetitions(s1: String, n1: i32, s2: String, n2: i32) -> i32 {\n        if n1 == 0 {\n            return 0;\n        }
```rust\nimpl Solution {\n    pub fn get_max_repetitions(s1: String, n1: i32, s2: String, n2: i32) -> i32 {\n        if n1 == 0 {\n            return 0;\n        };\n        let mut indices = vec![0; n1 as usize + 1];\n        let mut counts = vec![0; n1 as usize + 1];\n        let mut index = 0;\n        let mut count = 0;\n        for i in 1..=n1 as usize {\n            for j in 0..s1.len() {\n                if s1.as_bytes()[j] == s2.as_bytes()[index] {\n                    index += 1;\n                }\n                if index == s2.len() {\n                    index = 0;\n                    count += 1;\n                }\n            }\n            counts[i] = count;\n            indices[i] = index;\n            for k in 0..i {\n                if indices[k] == index {\n                    let pre_count = counts[k];\n                    let pattern_count = (n1 - k as i32) / (i - k) as i32 * (counts[i] - pre_count);\n                    let remain_count = counts[k + (n1 as usize - k) % (i - k)] - pre_count;\n                    return (pre_count + pattern_count + remain_count) / n2;\n                }\n            }\n        }\n        counts[n1 as usize] / n2\n    }\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    #[test]\n    fn test_get_max_repetitions() {\n        assert_eq!(\n            Solution::get_max_repetitions("acb".to_string(), 4, "ab".to_string(), 2),\n            2\n        )\n    }\n\n    #[test]\n    fn test_get_max_repetitions_02() {\n        assert_eq!(\n            Solution::get_max_repetitions("aaa".to_string(), 20, "aaaaa".to_string(), 1),\n            12\n        )\n    }\n\n    #[test]\n    fn test_get_max_repetitions_03() {\n        assert_eq!(\n            Solution::get_max_repetitions("bacaba".to_string(), 3, "abacab".to_string(), 1),\n            2\n        )\n    }\n\n    #[test]\n    fn test_get_max_repetitions_04() {\n        assert_eq!(\n            Solution::get_max_repetitions("ecbafedcba".to_string(), 3, "abcdef".to_string(), 1),\n            1\n        )\n    }\n}\n```
[]