作业帮 > 英语 > 作业

英语翻译A simple scheme for creating a compressed version of a t

来源:学生作业帮 编辑:作业帮 分类:英语作业 时间:2024/05/03 21:05:10
英语翻译
A simple scheme for creating a compressed version of a text file can be used for files which contain no digit characters.The compression scheme requires making a list of the words in the uncompressed file.When a non-alphabetic character is encountered in the uncompressed file,it is copied directly into the compressed file.When a word is encountered in the uncompressed file,it is copied directly into the compressed file only if this is the first occurrence of the word.In that case,the word is put at the front of the list.If it is not the first occurrence,the word is not copied to the compressed file.Instead,its position in the list is copied into the compressed file and the word is moved to the front of the list.The numbering of list positions begins at 1.
Write a program that takes a compressed file as input and generates a reproduction of the original uncompressed file as output.You can assume that no word contains more than 50 characters and that the original uncompressed file contains no digit characters.
For the purposes of this problem,a word is defined to be a maximal sequence of upper- and lower-case letters.Words are case-sensitive—the word abc is not the same as the word Abc.For example,
x-ray contains 2 words:x and ray
Mary's contains 2 words:Mary and s
It's a winner contains 4 words:It and s and a and winner
There is no upper limit on the number of different words in the input file.The end of the input file is signified by the number 0 on a line by itself.The terminating 0 merely indicates the end of the input and should not be part of the output produced by your program.
Sample Input
Dear Sally,
Please,please do it--1 would 4
Mary very,1 much.And 4 6
8 everything in 5's power to make
14 pay off for you.
-- Thank 2 18 18--
0
Output for the Sample Input
Dear Sally,
Please,please do it--it would please
Mary very,very much.And Mary would
do everything in Mary's power to make
it pay off for you.
-- Thank you very much--
这是一道C程序设计题!不要拿百度或者其他的什么在线翻译.......
用于创建一个文本文件的压缩版本,可以使用简单的计划,其中包含的文件没有数字字符.压缩计划需要作出在压缩文件中的单词列表.当一个非字母字符是在未压缩文件的困难,它是直接复制到压缩文件.当一个单词在压缩文件中遇到的,它是直接复制到压缩文件只如果这是这个词第一次出现.在这种情况下,这个词是放在列表的前面.如果不是第一次出现,这个词是不是复制到压缩文件.相反,它在列表中的位置被复制到压缩文件和文字移动到列表的前面.职位编号的列表开始于1.
编写一个程序,需要一个作为输入压缩文件并生成一个作为输出的原始未压缩的文件复制.你可以假设,任何一个字包含超过50个字符,而原来的压缩文件不包含数字字符.
对于这个问题的目的,一个字被定义为一个大写和小写字母最大序列.语言是区分大小写,单词ABC是不一样的单词美国广播公司相同.例如,
X射线包含2话:X和射线
玛丽的包含2话:玛丽和s
这是一个赢家包含4个字:这和s,a和赢家
有没有不同的话在输入文件数目上限.在输入文件中所表达的目的是对自己的行号为0.该终止0只是指示输入结束,不应该由您的程序产生的输出的一部分.
样本输入
亲爱的莎莉,
请,请这样做 - 一会4
玛丽非常,一大部分.和4 6
8一切5的权力,
14为你还清.
- 18 18 -
0
输入输出示例
亲爱的莎莉,
请,请这样做 - 这将请
玛丽非常,非常多.和玛丽会
尽在玛丽的权力,使
它为你还清.
- -