fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n;
  6. cin>>n;
  7. int c=0;
  8. while (n > 0) {
  9. n/= 10;
  10. c++;
  11. }
  12. cout <<c<<endl;
  13. return 0;
  14. }
  15.  
Success #stdin #stdout 0.01s 5280KB
stdin
123
stdout
3