Return the first k number of digits from number . If the number of digits in number is less than k , return number .
long getPrefix ( long number , int k ) { if ( getSize ( number ) > k ) { string num = to_string ( number ) ; return stol ( num . substr ( 0 , k ) ) ; } return number ; }