refactor repetition remover
This commit is contained in:
parent
bb86bde8a5
commit
026912ca9c
@ -23,17 +23,13 @@ void RemoveRepeatedChars(std::wstring& sentence)
|
|||||||
void RemoveCyclicRepeats(std::wstring& sentence)
|
void RemoveCyclicRepeats(std::wstring& sentence)
|
||||||
{
|
{
|
||||||
remove:
|
remove:
|
||||||
std::wstring junk = sentence;
|
for (std::wstring junk = sentence; junk.size() > 4; junk.pop_back())
|
||||||
while (junk.size() > 4)
|
|
||||||
{
|
|
||||||
junk.pop_back();
|
|
||||||
if (sentence.rfind(junk) > 0)
|
if (sentence.rfind(junk) > 0)
|
||||||
{
|
{
|
||||||
sentence.erase(0, junk.size());
|
sentence.erase(0, junk.size());
|
||||||
goto remove;
|
goto remove;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
|
bool ProcessSentence(std::wstring& sentence, SentenceInfo sentenceInfo)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user