-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCaesarCipher.cpp
More file actions
64 lines (58 loc) · 1.1 KB
/
CaesarCipher.cpp
File metadata and controls
64 lines (58 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/*
* Aizu 0017
* Created by Ziyi Tang
* Ascii Code for Letters
*/
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
using namespace std;
#define INF (int)1E9
#define INFL (long)1E18
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
typedef vector<vpi> vvpi;
const int dir[4][2] = {{1,0},{-1,0},{0,1},{0,-1}};
int main(){
string line;
while (getline(cin,line) && line != ""){
int sz = line.size();
while(true){
for (int i = 0; i < sz; i++){
if (line[i] != ' ' && line[i] != '.' && line[i] != EOF){
int tmp = (int)line[i] + 1;
while (tmp > 122){
tmp -= 26;
}
line[i] = (char)tmp;
}
}
stringstream ss(line);
string ts;
int flag = 0;
while(ss >> ts){
if (ts == "this" || ts == "the" || ts == "that"){
flag = 1;
break;
}
}
if (flag == 1){
break;
}
}
cout << line << endl;
}
return 0;
}