在段落中找到重复的单词. [英] find repeted word in the paragraph.

查看:77
本文介绍了在段落中找到重复的单词.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个段落,我们想找出重复出现多少次的单词.这给了
输出单词,如果没有更多单词,则不输出时间")

''We have a Paragraph in which we want to find out the word which are repeat how many time.That''s give
output the word and no of time if it''s come more tha one times'')

推荐答案

Psuedocode:

声明一个动态列表.每个元素应包含一个可变长度的字符串和一个数字计数.

1.输入下一个单词
2.将其与单词列表中的每个元素进行比较(此列表最初为空)
3.如果找到,则在该元素中增加计数器
4.如果未找到,则将其添加到列表中,并在该元素中增加计数器
5.如果还有其他单词,请在步骤1重复.
6.如果没有其他单词,请扫描列表并显示单词及其计数器
Psuedocode:

Declare a dynamic list. Each element should contain a variable-length string and a numeric count.

1. Input the next word
2. Compare it with each element in the list of words (this list is initially empty)
3. If it is found, increment the counter in that element
4. If it is not found, add it to the list and increment the counter in that element
5. If more words remain, repeat at step 1.
6. If no more words remain, scan the list and display the words and their counters


这篇关于在段落中找到重复的单词.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆