题目如下:
TODO
请编写一个C++程序,接收用户输入的带有标点符号的原文,输出删除重复词后的结果。注意标点符号也要正确输出。
请不要使用vector,string.
如果句子中有超过两个单词重复词,则同样只保留一个。
注意如果两个相同的单词中间有其他单词或标点符号隔开(或超过一个空格),则不算重复词。
本题有如下规定:
① 连字符、数字和单引号也为单词的一部分(比如 e-mail , 2nd 和 it's),其余符号均不算。
② 大小写敏感,比如 Test test 不算重复词。
输入输出格式说明
输入格式说明
输入内容为一行字符串,由英文字母与标点符号组成,其长度范围为 (0,200) 。需要删除的单个重复词的长度范围在(0,16)。重复词中间仅一个空格隔开。
你不需要考虑非法输入。
输出格式说明
输出删除重复词后的字符串。
不用添加输入输出提示。
样例一
输入:
It's It's been a long day without you you my friend.
输出:
It's been a long day without you my friend.
样例二
输入:
Where did did did you come from from, Cotton-Eye Joe Joe?
输出:
Where did you come from, Cotton-Eye Joe?
样例三
输入:
"I've I've been walking these streets so long, wondering wondering wondering how we ended up here like this this this... and and we've only just begun." He He said.
输出:
"I've been walking these streets so long, wondering how we ended up here like this... and we've only just begun." He said.
这个题目已经折磨了我两天了,主要是不能用string和vector,而且标点和空格不能多输出。
TODO
请编写一个C++程序,接收用户输入的带有标点符号的原文,输出删除重复词后的结果。注意标点符号也要正确输出。
请不要使用vector,string.
如果句子中有超过两个单词重复词,则同样只保留一个。
注意如果两个相同的单词中间有其他单词或标点符号隔开(或超过一个空格),则不算重复词。
本题有如下规定:
① 连字符、数字和单引号也为单词的一部分(比如 e-mail , 2nd 和 it's),其余符号均不算。
② 大小写敏感,比如 Test test 不算重复词。
输入输出格式说明
输入格式说明
输入内容为一行字符串,由英文字母与标点符号组成,其长度范围为 (0,200) 。需要删除的单个重复词的长度范围在(0,16)。重复词中间仅一个空格隔开。
你不需要考虑非法输入。
输出格式说明
输出删除重复词后的字符串。
不用添加输入输出提示。
样例一
输入:
It's It's been a long day without you you my friend.
输出:
It's been a long day without you my friend.
样例二
输入:
Where did did did you come from from, Cotton-Eye Joe Joe?
输出:
Where did you come from, Cotton-Eye Joe?
样例三
输入:
"I've I've been walking these streets so long, wondering wondering wondering how we ended up here like this this this... and and we've only just begun." He He said.
输出:
"I've been walking these streets so long, wondering how we ended up here like this... and we've only just begun." He said.
这个题目已经折磨了我两天了,主要是不能用string和vector,而且标点和空格不能多输出。