fork download
  1. #include <iostream>
  2. #include <cstring>
  3. #include <stdio.h>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8. int input;
  9. char buffer[30];
  10.  
  11. while (cin >> input)
  12. {
  13. cout << "Length of " << input << " is " << sprintf(buffer, "%d", input) << endl;
  14. }
  15.  
  16. return 0;
  17. }
Success #stdin #stdout 0s 3460KB
stdin
1 71283 162317823 64646 7 5123123 0
stdout
Length of 1 is 1
Length of 71283 is 5
Length of 162317823 is 9
Length of 64646 is 5
Length of 7 is 1
Length of 5123123 is 7
Length of 0 is 1