-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1404.cpp
More file actions
39 lines (34 loc) · 682 Bytes
/
1404.cpp
File metadata and controls
39 lines (34 loc) · 682 Bytes
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
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
string s;
cin >> s;
int h=0;
int n = s.length();
int* sn = new int[n];
for (int i = 0; i < n; i++)
sn[i] = s[i] - 97;
for (int i = (n-1); i > 0; i--)
{
if (sn[i] > sn[i - 1])
sn[i] = sn[i] - sn[i - 1];
else
{
sn[i] = 26 - sn[i - 1] + sn[i];
if (sn[i] > 25)
sn[i] = sn[i] - 26;
}
}
if (sn[0] < 5)
sn[0] = sn[0] + 21;
else
sn[0] = sn[0] - 5;
for (int i = 0; i < n; i++)
{
char k = sn[i] + 97;
cout << k;
}
}