Without converting to long long/


#1

Hint:- Take an initial string “1” and multiply it by 2 and after each multiplication check whether it is equal to A.


#2

Getting TLE with this.