题解 | #字符个数统计#

字符个数统计

http://www.nowcoder.com/practice/eb94f6a5b2ba49c6ac72d40b5ce95f50

#include <string>
#include <set>

using namespace std;

int main() {
    string str;
    set<char> setc;
    int cnt=0;
   
    while(cin>>str){
        
        for(int i = 0;i<str.size();i++){
            if(setc.count(str[i])!=1){
                setc.insert(str[i]);
            }
            
        }
        auto it =setc.begin();
        while(it!=setc.end()) cnt++,it++;
        cout<<cnt<<endl;
    }
    
    
}
全部评论

相关推荐

头像
04-02 20:00
点赞 评论 收藏
转发
点赞 收藏 评论
分享
牛客网
牛客企业服务