Implement a type LengthOfString<S> just like Array#length:

Differing to two previous challenges about strings' length, this times the type must support strings about $10^6$ characters long, which makes it more challenging.