Given a UTF-8 string, give a string that represents byte counts of each characters.
As long as the input string is encoded in UTF-8 (without BOM), its type doesn't matter. In C++, it can be
std::string. In Haskell, it can be
The output must be (in usual case) a string of ASCII digit characters. Its encoding doesn't matter.
When given an invalid UTF-8 sequence (including representation of surrogates), every bytes of the sequence are to be represented as the replacement character �.
Reserved characters and noncharacters are still considered as valid UTF-8 sequences, and thus must have corresponding output digit.
As this is a code-golf, the shortest code in bytes wins.
When given the following byte sequence:
00 80 C0 80 EB 80 80
The output must be: