// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
#include <iostream>
#include <cmath>

using namespace std;

int len(int v)
{
    if(v > 0)
        return (int)log10((double)v)+1;
    else
        return 1+len(-v);
}

int main()
{
   cout << len(123) << endl;
   cout << len(77777) << endl;
   cout << len(-1) << endl;
   return 0;
}
