fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n;
  6. cin >> n;
  7. if( ( 0 <= n ) and ( n <= 9 ) ) cout << 1;
  8. else if( ( 10 <= n ) and ( n <= 99 ) ) cout << 2;
  9. else if( ( 100 <= n ) and ( n <= 999 ) ) cout << 3;
  10. else if( ( 1000 <= n ) and ( n <= 9999 ) ) cout << 4;
  11. else if( ( 10000 <= n ) and ( n <= 99999 ) ) cout << 5;
  12. else if( ( 100000 <= n ) and ( n <= 999999 ) ) cout << 6;
  13. else if( ( 1000000 <= n ) and ( n <= 9999999 ) ) cout << 7;
  14. else if( ( 10000000 <= n ) and ( n <= 99999999 ) ) cout << 8;
  15. else if( ( 100000000 <= n ) and ( n <= 999999999 ) ) cout << 9;
  16. else if( ( 1000000000 <= n ) and ( n <= 2000000000 ) ) cout << 10;
  17. return 0;
  18. }
Success #stdin #stdout 0s 15232KB
stdin
12345
stdout
5