2282 - L1098 的题解

回去原题
#tream>    
#include <cstdlib>    
#include <cstdio>    
#include <string>    
    
using namespace std;    
    
int main() {    
    string a;    
    int x,y,z;    
    cin >> x >> y >> z >> a;    
    for(int i=1;i<a.length()-1;i++) {    
        if((a[i] == '-') && (a[i-1]<a[i+1]) && (a[i+1]-a[i-1] <= 26) && (a[i+1] != '-') && (a[i-1] != '-')) {    
            string tf = "";    
            int start = z == 1 ? a[i-1]+1 : a[i+1]-1, end = z == 1 ? a[i+1]-1 : a[i-1]+1;    
            for(int j=start; z==1?j<=end:j>=end; z==1?j++:j--) for(int k=1;k<=y;k++) tf += x == 1 ? tolower(j) : x == 2 ? toupper(j) : '*';  
            a.replace(i, 1, tf);    
        }    
    }    
    cout << a;    
}
[/codec]