#include <iostream>
#include <string>
#include <set>
using namespace std;
int solution(string word) {
// PLEASE DO NOT MODIFY THE FUNCTION SIGNATURE
// write code here
std::set<int> set = {};
word.append("a");//最后添加任意的字母
int temp = 0;
int flag = 0;
for(auto c: word){
if(c >= '0' && c <= '9'){
temp = temp * 10 + c - '0';
flag = 1;
}else{
if(flag == 1){
set.insert(temp);
temp = 0;
flag = 0;
}
}
}
return set.size();
}
int main() {
cout << (solution("a123bc34d8ef34") == 3) << endl;
cout << (solution("t1234c23456") == 2) << endl;
cout << (solution("a1b01c001d4") == 2) << endl;
return 0;
}
set记录存在的数字种类,flag标志位说明是否是需要记录的数字