February 25, 2020, 08:07:21 am

Delete a Sub Strings

Started by TechShristi, September 08, 2012, 10:45:01 am

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

TechShristi

How to Delete a sub Strings?


#include<iostream>
#include<string>
using namespace std;

string fun(string s, int n)
{ string ne="";

for(int i=0;i<s.size();i=i+n)
{     
     
      if((i+n)<s.size())
       {
     if(s.substr(i,n) != s.substr(i+n,n))
        ne=ne+s.substr(i,n);
       }
      else
     {
       
          for(int k=i;k<s.size();k++)
          ne=ne+s[k];           
     }
}

return ne;
}

  main()
  {
  string t,s;
    cin>>t;
    s=t;
    string ne="";
    int l=s.size();
    int x=0;   
    for(int i=1;i<=l;i++)
    {
          for(int k=1;k<=i;k++)
        s=fun(s,k);
    }
    cout<<s;   
}



TechShristi


TechShristi

Hello admin123,  September 8, 2012, 10:45 am

Welcome to Techshristi Forum

In case if you find any link not working or any Abnormal activity then contact us at
[email protected]

PLEASE HELP US TO IMPROVE OUR FORUM.

YOU CAN VISIT OUR WEBSITE FOR THE PROJECTS AT

http://techshristi.com/

TechShristi


Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Note: this post will not display until it's been approved by a moderator.

Name:
Email:
Verification:
Please leave this box empty:
Type the letters shown in the picture
Listen to the letters / Request another image

Type the letters shown in the picture:

Shortcuts: ALT+S save/post or ALT+P preview