fork download
  1. #include <iostream>
  2. #include <deque>
  3. using namespace std;
  4.  
  5. int main(){
  6. deque<int> folder;
  7. unsigned long long N;
  8.  
  9. cin >> N;
  10. folder.push_back(N%10);
  11. N/=10;
  12. while (N!=0){
  13. for (int i=0; i<folder.size(); i++){
  14. if (folder.at(i) == N%10)
  15. i+=folder.size();
  16. if (i == folder.size() -1)
  17. folder.push_back(N%10);
  18. }
  19. N/=10;
  20. }
  21. cout << "sum:" << folder.size();
  22.  
  23. return 0;
  24. }
Success #stdin #stdout 0s 15240KB
stdin
12345678900987654321
stdout
sum:10