Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 240159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T20:38:36+00:00 2026-05-11T20:38:36+00:00

My main problem is trying to find a suitable solution to automatically turning this,

  • 0

My main problem is trying to find a suitable solution to automatically turning this, for example:

d+c+d+f+d+c+d+f+d+c+d+f+d+c+d+f+

into this:

[d+c+d+f+]4

i.e. Finding duplicates next to each other, then making a shorter “loop” out of these duplicates.
So far I have found no suitable solution to this, and I look forward to a response. P.S. To avoid confusion, the aforementioned sample is not the only thing that needs “looping”, it differs from file to file. Oh, and this is intended for a C++ or C# program, either is fine, though I’m open to any other suggestions as well. Also, the main idea is that all the work would be done by the program itself, no user input except for the file itself.
Here is the full file, for reference, my apologies for the stretched page:
#0 @16 v225 y10 w250 t76

l16
$ED $EF $A9
p20,20
>ecegb>d<bgbgecgec<g
>d+<b>d+f+a+>c+<a+f+a+f+d+<b>f+d+<bf+
>c<a>cegbgegec<a>ec<ae
>
d+c+d+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r2f+4^g+r2
f+4^fr2f+4^g+r2
f+4^fr2f+4^g+r2
f+4^fr2f+4^g+r2
f+4^fr2f+4^g+r2
f+4^fr2
>
a+4^g+r2
f+1a+4^g+r2
f+1
f+4^fr2
d+1
f+4^fr2
d+2^d+4^
r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1

#3 @10 v210 y10

r1^1
o3
c8r8d8r8
c8r8c8r8c8r8c8r8c8r8c8r8c8r8c8r8c8r8c8r8c8r8
c8
@10d16d16@21
c8
@10d16d16@21
c8
@10d16d16@21
/
c4@10d8@21c8<b8>c8@10d8@21c8c4@10d8@21c8<b8>c8@10d8@21c8c4@10d8@21c8<b8>c8@10d8@21c8c4@10d8@21c8<b8>c8@10d8@21c8c4@10d8@21c8<b8>c8@10d8@21c8c4@10d8@21c8<b8>c8@10d8@21c8c4@10d8@21c8<b8>c8@10d8@21c8c4@10d8@21c8<b8>c8@10d8@21c8c4@10d8@21c8<b8>c8@10d8@21c8c4@10d8@21c8<b8>c8@10d8@21c8c4@10d8@21c8<b8>c8@10d8@21c8
c4@10d8@21c8<b8>
@10d16d16d16d16d16r16
c4@10d8@21c8<b8>c8@10d8@21c8c4@10d8@21c8<b8>c8@10d8@21c8c4@10d8@21c8<b8>c8@10d8@21c8c4@10d8@21c8<b8>c8@10d8@21c8c4@10d8@21c8<b8>c8@10d8@21c8c4@10d8@21c8<b8>c8@10d8@21c8c4@10d8@21c8<b8>c8@10d8@21c8c4@10d8@21c8<b8>c8@10d8@21c8c4@10d8@21c8<b8>c8@10d8@21c8c4@10d8@21c8<b8>c8@10d8@21c8c4@10d8@21c8<b8>c8@10d8@21c8c4@10d8@21c8<b8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r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1r1

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T20:38:37+00:00Added an answer on May 11, 2026 at 8:38 pm

    Not sure if this is what you are looking for.

    I took the string “testtesttesttest4notaduped+c+d+f+d+c+d+f+d+c+d+f+d+c+d+f+testtesttest” and converted it to “[test]4 4notadupe[d+c+d+f+]4 [test]3 “

    I’m sure someone will come up with a better more efficient solution as it’s a bit slow when processing your full file. I look forward to other answers.

            string stringValue = "testtesttesttest4notaduped+c+d+f+d+c+d+f+d+c+d+f+d+c+d+f+testtesttest";
    
            for(int i = 0; i < stringValue.Length; i++)
            {
                for (int k = 1; (k*2) + i <= stringValue.Length; k++)
                {
                    int count = 1;
    
                    string compare1 = stringValue.Substring(i,k);
                    string compare2 = stringValue.Substring(i + k, k);
    
                    //Count if and how many duplicates
                    while (compare1 == compare2) 
                    {
                        count++;
                        k += compare1.Length;
                        if (i + k + compare1.Length > stringValue.Length)
                            break;
    
                        compare2 = stringValue.Substring(i + k, compare1.Length);
                    } 
    
                    if (count > 1)
                    {
                        //New code.  Added a space to the end to avoid [test]4 
                        //turning using an invalid number ie: [test]44.
                        string addString = "[" + compare1 + "]" + count + " ";
    
                        //Only add code if we are saving space
                        if (addString.Length < compare1.Length * count)
                        {
                            stringValue = stringValue.Remove(i, count * compare1.Length);
                            stringValue = stringValue.Insert(i, addString);
                            i = i + addString.Length - 1;
                        }
                        break;
                    }
                }
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 111k
  • Answers 112k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The refer(r)er can be found in the $_SERVER global variable.… May 11, 2026 at 9:50 pm
  • Editorial Team
    Editorial Team added an answer Have you tried using getJSON()? If that's not, I'm gonna… May 11, 2026 at 9:50 pm
  • Editorial Team
    Editorial Team added an answer Right-trim the substrings as you go: (?<sub>.{1,40})(?:\s+|$)|(?<sub>.{40}) The first alternative… May 11, 2026 at 9:50 pm

Related Questions

Maybe there is a method that does this that I don't know about -
I am currently developing a (somewhat large) site for a magazine, the site mainly
What is the proper technique to have ThreadA signal ThreadB of some event, without
1 <span class='Txt9Gray'>Decisions ( </span> I'm trying to grab the 1 from this string.
Coming from this question , I have a wxComboCtrl with a custom popup made

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.