U E D R , A S I H C RSS

The Hardest Problem Ever/권순의

Status

Problem 1298Userfinchpark
Memory224KTime0MS
LanguageC++ResultAccepted

Source

#include <iostream>
#include <string>
#include <cstring>
#include <vector>

using namespace std;

void printDecipher(string chiper);

const int NUM = 200;

int main()
{
	vector<string> inputChiper(NUM);
	string decipher;
	string input;
	string end;
	int count = 0;

	for(int i = 0; i < 100; i++)
	{
		getline(cin, input);

		if(input == "START")
		{
			getline(cin, inputChiper[i]);
			getline(cin, end);
			count++;
		}else if(input == "ENDOFINPUT"){
			break;
		}else{
			cout << "Wrong input" << endl;
			exit(0);
		}
	}
	
	for(int i = 0; i < count; i++)
		printDecipher(inputChiper[i]);

	return 0;
}

void printDecipher(string chiper)
{
	vector<string> print(100);

	for(int i = 0; i < chiper.size(); i++)
	{
		int chip = (int)chiper[i];

		if((chip >= 65) && (chip <= 69))
			print[i] = (char)(chip + 21);
		else if((chip >= 70) && (chip <= 90))
			print[i] = (char)(chip - 5);
		else
			print[i] = (char)chip;
		
		cout << print[i];
	}
	cout << endl;
}
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:28:12
Processing time 0.0074 sec