首页 > 代码库 > 我和你

我和你

 

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
const int M=1000;
int main()
{
    string china;
    int a[M]={-1},b[M]={-1},i,indexa,indexb,len,m;
    len=strlen(""); 
    //freopen("637.in","r",stdin);
    //freopen("637.out","w",stdout);
    cin>>china;
    while(china!="0")
    {        
        m=china.length();    
        for(i=0;i<m;i++)
        {
            a[i]=b[i]=-1;
        } 
        indexa=indexb=0;
        while(true)
        {
            indexa=china.find("",indexa);
            if(indexa==string::npos) break;
            a[indexa]=1;
            indexa++;
        }
        while(true)
        {
            indexb=china.find("",indexb);
            if(indexb==string::npos) break;    
            b[indexb]=1;    
            indexb++;
        }
        for(i=0;i<m;i++)
        {
            if(a[i]==1)
            {
                china.replace(i,len,""); 
            }
            if(b[i]==1)
            {    
                china.replace(i,len,"");                 
            }
        }    
        cout<<china<<endl;
        cin>>china;
        }
    return 0;
}