fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main(){
  5. int folder[10]={0}, sum=0;
  6. long long N;
  7.  
  8. cin >> N;
  9. while (N!=0){
  10. folder[N%10]++;
  11. N/=10;
  12. }
  13. for (int j=0; j<10; j++)
  14. if(folder[j]!=0) sum++;
  15. cout << "sum:" << sum;
  16.  
  17. return 0;
  18. }
Success #stdin #stdout 0s 16064KB
stdin
302
stdout
sum:3