#include <bits/stdc++.h>
using
namespace
std;
string Decryption(string s, string key)
{
vector<string> msg;
vector<string> ans;
istringstream s1(s);
istringstream s2(key);
string word;
while
(s1 >> word) {
msg.push_back(word);
}
while
(s2 >> word) {
ans.push_back(word);
}
for
(
int
i = 0; i < msg.size(); i++) {
string message = msg[i];
string hint = ans[msg.size() - i - 1];
int
value = hint.size();
if
(value % 2) {
for
(
int
i = 0; i < message.size(); i++) {
if
((message[i] - 0) + value > 122) {
int
val = message[i] + value - 122;
int
temp = 96 + val;
message[i] = (
char
)temp;
}
else
{
int
val = message[i] + value;
message[i] = (
char
)val;
}
}
}
else
{
for
(
int
i = 0; i < message.size(); i++) {
if
((message[i] - 0) - value < 97) {
int
val = message[i] - 96 - value;
int
temp = 122 + val;
message[i] = (
char
)temp;
}
else
{
int
val = message[i] - value;
message[i] = (
char
)val;
}
}
}
msg[i] = message;
}
string f_ans =
""
;
for
(
int
i = 0; i < msg.size(); i++) {
f_ans += msg[i];
if
(i < msg.size() - 1)
f_ans +=
' '
;
}
return
f_ans;
}
int
main()
{
string Message =
"qiix gz clro"
;
string Key =
"one orange ball"
;
cout << Decryption(Message, Key);
return
0;
}
#include <bits/stdc++.h>
using
namespace
std;
string Decryption(string s, string key)
{
vector<string> msg;
vector<string> ans;
istringstream s1(s);
istringstream s2(key);
string word;
while
(s1 >> word) {
msg.push_back(word);
}
while
(s2 >> word) {
ans.push_back(word);
}
for
(
int
i = 0; i < msg.size(); i++) {
string message = msg[i];
string hint = ans[msg.size() - i - 1];
int
value = hint.size();
if
(value % 2) {
for
(
int
i = 0; i < message.size(); i++) {
if
((message[i] - 0) + value > 122) {
int
val = message[i] + value - 122;
int
temp = 96 + val;
message[i] = (
char
)temp;
}
else
{
int
val = message[i] + value;
message[i] = (
char
)val;
}
}
}
else
{
for
(
int
i = 0; i < message.size(); i++) {
if
((message[i] - 0) - value < 97) {
int
val = message[i] - 96 - value;
int
temp = 122 + val;
message[i] = (
char
)temp;
}
else
{
int
val = message[i] - value;
message[i] = (
char
)val;
}
}
}
msg[i] = message;
}
string f_ans =
""
;
for
(
int
i = 0; i < msg.size(); i++) {
f_ans += msg[i];
if
(i < msg.size() - 1)
f_ans +=
' '
;
}
return
f_ans;
}
int
main()
{
string Message =
"qiix gz clro"
;
string Key =
"one orange ball"
;
cout << Decryption(Message, Key);
return
0;
}