Compound Words

You are to find all the two-word compound words in a dictionary. A two-word compound word is a word in the dictionary that is theconcatenation of exactly two other words in the dictionary.

Input

Standard input consists of a number of lowercase words, one per line,in alphabetical order. There will be no more than 120,000 words.

Output

Your output should contain all the compound words, one per line, inalphabetical order.

Sample Input

a
alien
born
less
lien
never
nevertheless
new
newborn
the
zebra

 

Sample Output

alien
newborn


AC代码:
#include"iostream"
#include"set"
using namespace std; int main() { set<string> dic; string s; while(cin>>s) dic.insert(s); set<string> ::iterator it; for(it=dic.begin();it!=dic.end();it++) { string str,sub1,sub2; str=*it; for(int i=0;i<str.size()-1;i++) { sub1=str.substr(0,i+1); sub2=str.substr(i+1,str.size()-i-1); if(dic.find(sub1)!=dic.end()&&dic.find(sub2)!=dic.end()) { cout<<str<<endl; break; //一定要即时break掉,以免重复 } } } return 0; }

转载于:https://www.cnblogs.com/zsyacm666666/p/4659949.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
英语的常用词根词缀有: 1. 词根(Root):常常是一个单词的核心部分,可以用来构建其他单词。例如,act(行动)是一个词根,可以衍生出active(积极的)、action(行动)、actor(演员)等单词。 2. 前缀(Prefix):通常出现在单词的开头,可以改变词的含义或词性。例如,un-(不)是一个常见的前缀,可以将happy(快乐)变成unhappy(不快乐)。 3. 后缀(Suffix):通常出现在单词的结尾,可以改变词的词性或形态。例如,-ly(副词后缀)可以将adjective(形容词)变成adverb(副词),例如quick(快速的)变成quickly(快速地)。 4. 合成词(Compound words):由两个或更多的词根、前缀或后缀组合而成的单词。例如,sunflower(向日葵)由sun和flower组成。 5. 派生词(Derivatives):由一个词根加上前缀或后缀构成的单词。例如,enjoyment(享受)由enjoy和-ment(名词后缀)组成。 6. 表示数量的词缀(Numerical prefixes):例如bi-(两个)和tri-(三个)等可以用来表示数量的前缀。 7. 表示时间的词缀(Temporal prefixes):例如pre-(之前)和post-(之后)等可以用来表示时间的前缀。 8. 表示空间的词缀(Spatial prefixes):例如inter-(之间)和intra-(内部)等可以用来表示空间的前缀。 9. 表示语法的词缀(Grammatical suffixes):例如-ly(副词后缀)和-able(形容词后缀)等可以用来表示语法的后缀。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值