More actions
imported>novaman No edit summary |
imported>novaman No edit summary |
||
| Line 1: | Line 1: | ||
== Status == | |||
{| class="wikitable" | |||
|- | |||
| Problem | |||
| 1298 | |||
| User | |||
| finchpark | |||
|- | |||
| Memory | |||
| 224K | |||
| Time | |||
| 0MS | |||
|- | |||
| Language | |||
| C++ | |||
| Result | |||
| Accepted | |||
|} | |||
== Source == | |||
#include <iostream> | #include <iostream> | ||
#include <string> | #include <string> | ||
Revision as of 13:52, 10 July 2011
Status
| Problem | 1298 | User | finchpark |
| Memory | 224K | Time | 0MS |
| Language | C++ | Result | Accepted |
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;
}