Techshristi's Forum

Author Topic: Delete a Sub Strings  (Read 1435 times)

0 Members and 1 Guest are viewing this topic.

Offline TechShristi

  • Welclome to Techshristi
  • Administrator
  • *****
  • Posts: 556
    • techshristi
Delete a Sub Strings
« on: September 08, 2012, 10:45:01 AM »
How to Delete a sub Strings?


Code: [Select]
#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's Forum

Delete a Sub Strings
« on: September 08, 2012, 10:45:01 AM »

Offline TechShristi

  • Welclome to Techshristi
  • Administrator
  • *****
  • Posts: 556
    • techshristi
Delete a Sub Strings
« Reply #1 on: September 08, 2012, 10:45:01 AM »
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's Forum

Delete a Sub Strings
« Reply #1 on: September 08, 2012, 10:45:01 AM »

 
Sitemap 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18