View Code of Problem 3308

#include<iostream>
#include<string>
#include<cstring>
using namespace std;
int main() {
	string start;
	while (getline(cin, start) && start != "ENDOFINPUT") {
		string password;
		getline(cin, password);
		for (int i = 0; i < password.length(); i++)
		{
			if (password[i] >= 'A' && password[i] <= 'Z') {
				cout << ((password[i] - 5 - 'A') < 0 ? (char)(password[i] + 21) : (char)(password[i]-5));
			}
			else {
				cout << password[i];
			}
		}
		cout << endl;
		string end;
		getline(cin, end);
		if (end == "END")
			continue;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 3308