#include <iostream>
#include <cmath>
using namespace std;
int main() {
long a = 42556;
long num;
num=floor(log10(a))+1;
//cout<<num<<" "<<"\n"; //this will print the number of digits in the number
cout<<"first num: "<<a/(int)pow(10,num-1)<<"\n";
cout<<"last num: "<<a%10<<"\n";
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8Y21hdGg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpIHsKCWxvbmcgYSA9IDQyNTU2OwoJbG9uZyBudW07CgludW09Zmxvb3IobG9nMTAoYSkpKzE7IAoJLy9jb3V0PDxudW08PCIgIjw8IlxuIjsgIC8vdGhpcyB3aWxsIHByaW50IHRoZSBudW1iZXIgb2YgZGlnaXRzIGluIHRoZSBudW1iZXIKCQoJY291dDw8ImZpcnN0IG51bTogIjw8YS8oaW50KXBvdygxMCxudW0tMSk8PCJcbiI7Cgljb3V0PDwibGFzdCBudW06ICI8PGElMTA8PCJcbiI7CglyZXR1cm4gMDsKfQ==