• + 0 comments
    	
    int n = stoi(ltrim(rtrim(n_temp)));
        int counter{0};
        int maxCounter{0};
        
        while (n > 0) {
            
            if (n % 2 == 1)
                counter++;
            else {
                counter = 0;
            }
             
            n = round(n / 2);
    
            if (maxCounter < counter)
                maxCounter = counter;
        }
        
        cout << maxCounter << endl;