思维不严谨,假如 str[i]是'a', s是'A',但是 'a' + 32 != 'A'。 按你的代码就会少统计一次。要么加上 str[i] - 32 == s; 要么使用标准函数toupper或tolower。
点赞

相关推荐

牛客热帖

更多
牛客网
牛客企业服务