首页 > 代码库 > 九度 1105

九度 1105

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

#ifdef ONLINE_JUDGE                                   
#define FINPUT(file)  0
#define FOUTPUT(file) 0
#else                                                
#define FINPUT(file)  freopen(file,"r",stdin)
#define FOUTPUT(file) freopen(file,"w",stdout)
#endif

void convert(string &s)
{
	for(int i=0;i<s.length();i++)
	{
		if((s[i]>=‘a‘&&s[i]<=‘z‘))
		{
			s[i] = ‘z‘ - s[i] + ‘a‘;
		}
		else if((s[i]>=‘A‘&&s[i]<=‘Z‘))
			s[i] = ‘Z‘ - s[i] + ‘A‘;		
	}
}

int main()
{    
	FINPUT("in.txt");
    FOUTPUT("out.txt");

    string s; 
    while(getline(cin,s))
    {   
        if(s=="!")
			break;        
       convert(s);
       cout<<s<<endl;
    }
    return 0;
}