A perfect square has length n if its last n digits (in base 10) are the same and non-zero. What is the longest possible length? What is the smallest square achieving this length?