csharp高级练习题:BasE91编码和解码【难度:4级】:
BasE91是一种将二进制编码为ASCII字符的方法.它比Base64更有效,并且需要91个字符来表示编码数据.
使用以下ASCII字符:
‘ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789’
‘!#$%&()* +,/ :; <=> @ [] ^ _`.?{|}~"’
创建两个函数,将字符串编码为basE91字符串,然后反过来解码.
b91encode(‘test’)=‘fPNKd’
b91decode(‘fPNKd’)=‘测试’
b91decode(’> OwJh> Io0Tv!8PE’)=‘Hello World!’
b91encode(‘Hello World!’)=’> OwJh> Io0Tv!8PE’
输入字符串有效.
编程目标:
using System.Collections.Generic;
using System