acmsguru |
---|
Finished |
4:spam" represents the string "spam", "
0:" represents an empty string.
i1024e" represents the number 1024.
li101el4:spami1024eee" represents the list "[ 101, [ "spam", 1024 ] ]".
d1:a0:1:pl1:b2:cdee" represents the dictionary with string key "a" mapped into an empty string "", and key "p" mapped into the list "[ "b", "cd" ]".
2:bc" is not considered a valid bencoded object even though it represents a correctly encoded string "bc".
ok" (without quotes) if the given input character sequence is a valid bencoded object. Otherwise, print message "
Error at position j!". The first character of the input sequence is considered to have position "
0".
sample input | sample output |
14 li10e11:abcdefghijke | Error at position 6! |
sample input | sample output |
10 i-1e | Error at position 1! |
sample input | sample output |
3 i2 | Error at position 2! |
sample input | sample output |
18 dli1eei1ei1eli1eee | ok |
li10e1" can be extended to a valid bencoded object while not exceeding 14 characters in length (for example, "
li10e1:xe"). It's not the case with longer prefixes of length 7 and more, so j=6 in this case.
Name |
---|