zoukankan      html  css  js  c++  java
  • 翻译NYOJ

     1 #include<iostream>
     2 #include<string.h>
     3 #include<stdio.h>
     4 using namespace std;
     5 const int N = 1001;
     6 int main(){
     7   string s,a[N],b[N];
     8   int i=0,j=0,k=0;
     9   cin>>s;
    10   while(cin>>s){
    11     if(s=="END"){
    12       break;
    13     }
    14     if(k%2)b[j++]=s;//别人 
    15     else a[i++]=s;//自己 
    16     k++;
    17   }
    18   cin>>s;
    19   getchar();
    20   string ss[N*5];
    21   k=0;
    22   while(getline(cin,s)){
    23     if(s[0]=='E') break;
    24   //  string s1=s;
    25   //  cout<<s1<<endl;
    26     for(int p=0;p<i;p++){
    27       int q=s.find(b[p]);
    28       while(q!=string::npos){
    29       //  cout<<s[q+b[p].length()]<<endl;
    30         if((s[q+b[p].length()]<'a')||(s[q+b[p].length()]>'z'))
    31           s.replace(q,b[p].length(),a[p]);
    32       //  int k= a[p].length();
    33       //  cout<<a[p]<<" "<<k<<endl;
    34         q=s.find(b[p],q+1);
    35       }
    36     }
    37     ss[k++]=s;
    38   //  cout<<s<<endl;
    39   //  s1.clear();
    40   }
    41   for(int i=0;i<k;i++)
    42     cout<<ss[i]<<endl;
    43 }

    不知道哪里有错  欢迎留言 指出错误

  • 相关阅读:
    c语言之数据类型
    C语言之概述
    012.day12
    011.day011
    010.day010
    010.day08
    010.周六自习
    009.day07
    008.day06
    007.day05
  • 原文地址:https://www.cnblogs.com/dream-it-possible/p/6675240.html
Copyright © 2011-2022 走看看