Rust from votrubac, 4ms 100%
rust\nimpl Solution {\n    pub fn count_substrings(s: String, t: String) -> i32 {\n        let mut ans = 0;\n        let mut dpl = vec![vec![0; 101]; 101];\n   
```rust\nimpl Solution {\n    pub fn count_substrings(s: String, t: String) -> i32 {\n        let mut ans = 0;\n        let mut dpl = vec![vec![0; 101]; 101];\n        let mut dpr = vec![vec![0; 101]; 101];\n        for i in 1..=s.len() {\n            for j in 1..=t.len() {\n                if s.as_bytes()[i - 1] == t.as_bytes()[j - 1] {\n                    dpl[i][j] = 1 + dpl[i - 1][j - 1];\n                }\n            }\n        }\n\n        for i in (1..=s.len()).rev() {\n            for j in (1..=t.len()).rev() {\n                if s.as_bytes()[i - 1] == t.as_bytes()[j - 1] {\n                    dpr[i - 1][j - 1] = 1 + dpr[i][j];\n                }\n            }\n        }\n\n        for i in 0..s.len() {\n            for j in 0..t.len() {\n                if s.as_bytes()[i] != t.as_bytes()[j] {\n                    ans += (dpl[i][j] + 1) * (dpr[i + 1][j + 1] + 1);\n                }\n            }\n        }\n\n        ans\n    }\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    #[test]\n    fn test_count_substrings() {\n        assert_eq!(\n            Solution::count_substrings("aba".to_owned(), "baba".to_owned()),\n            6\n        );\n    }\n\n    #[test]\n    fn test_count_substrings_02() {\n        assert_eq!(\n            Solution::count_substrings("ab".to_owned(), "bb".to_owned()),\n            3\n        );\n    }\n\n    #[test]\n    fn test_count_substrings_03() {\n        assert_eq!(\n            Solution::count_substrings("a".to_owned(), "a".to_owned()),\n            0\n        );\n    }\n\n    #[test]\n    fn test_count_substrings_04() {\n        assert_eq!(\n            Solution::count_substrings("abe".to_owned(), "bbc".to_owned()),\n            10\n        );\n    }\n}\n```
[]