分享|用正则表达式刷每日一题(2026/12/04)

51
2026.12.04
2026.12.04
发布于 广东
3884. 双端字符匹配
3884. 双端字符匹配
C#
using System.Text.RegularExpressions;
public class Solution {
    public int FirstMatchingIndex(string s) {
        return Regex.Match(s, @"^(?=(.)*$)(?>(?>(?!\1).(?'-1'))*).").Length - 1;
    }
}
评论 (0)