c语言怎样压缩交作业,【c语言压缩文本文件求解答!写出来再加10分!48压缩文本文件成绩:5/折扣:0.8背景:压缩是一种有效的减小数据量的方法,目前已经被广泛应用于各种类型的信息系统之中。一种】作业...

c语言压缩文本文件 求解答!写出来再加10分!

48 压缩文本文件

成绩: 5 / 折扣: 0.8

背景:

压缩是一种有效的减小数据量的方法,目前已经被广泛应用于各种类型的信息系统之中。

一种压缩文本文件的方法如下:

1. 原始文本文件中的非字母的字符,直接拷贝到压缩文件中;

2. 原始文件中的词(全部由字母组成),如果是第一次出现,则将该词加入到一个词的列表中,并拷贝到压缩文件中;否则该词不拷贝到压缩文件中,而是将该词在词的列表中的位置拷贝到压缩文件中。

3. 词的列表的起始位置为 1 。 词的定义为文本中由大小写字母组成的最大序列。大写字母和小写字母认为是不同的字母,即 abc 和 Abc 是不同的词。词的例子如下: * x-ray 包括两个词 x 和 ray * mary's 包括两个词 mary 和 s * a c-Dec 包括三个词 a 和 c 和 Dec 编写一个程序,输入为一组字符串,输出为压缩后的文本。

输入:

输入为一段文本,你可以假设输入中不会出现数字、每行的长度不会超过 80 个字符,并且输入文本的大小不会超过 10M。

输出:

压缩后的文本。

测试输入

1.Please, please do it--it would please Mary very,↵

2.very much.↵

3.↵

4.Thanks↵

期待输出

1.Please, please do it--4 would 2 Mary very,↵

2.7 much.↵

3.↵

4.Thanks↵

测试输入1.Background↵

2.↵

3.Given an m by n grid of letters and a list of words, find the location in the↵

4.grid at which the word can be found.↵

5.↵

6.A word matches a straight, uninterrupted line of letters in the grid. A word↵

7.can match the letters in the grid regardless of case (i.e., upper- and↵

8.lowercase letters are to be treated as the same). The matching can be done in↵

9.any of the eight horizontal, vertical, or diagonal directions through the grid.↵

10.↵

11.Input↵

12.↵

13.The input begins with a single positive integer on a line by itself indicating↵

14.the number of cases, followed by a blank line. There is also a blank line↵

15.between each two consecutive cases.↵

16.↵

17.Each case begins with a pair of integers m followed by n on a single line,↵

18.where m, n in decimal notation. The next m lines contain n letters each,↵

19.representing the grid of letters where the words must be found. The letters↵

20.in the grid may be in upper- or lowercase. Following the grid of letters,↵

21.another integer k appears on a line by itself (k). The next k lines of inp↵

期待输出的形式和第一个测试用例一样

作业帮用户2017-07-06举报

6c0a0adef10d1043fa4f41a7897345ed.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值