Submission #9304

#TimeUsernameProblemLanguageResultExecution timeMemory
9304levant916Veni, vidi, vici (kriii2_V)C++98
Compilation error
0 ms0 KiB
#include <iostream> #include <string> using namespace std; string key[100]; string solve(string str, int n) { string ans; int cnt = str.size(); if (cnt % 2 == 1) cnt--; for (int i = 0; i < cnt; i+=2) { ans.push_back((str[i] - 'a' + str[i + 1] - 'a' - n) % 26 + 'a'); } return ans; } int main(void) { int n; cin >> n; char in; int cnt = 0; string str; char str2[101]; char c; getchar(); do { c = getchar(); if (c == ' ') { cnt++; }else if (c != '\n' ){ key[cnt].push_back(c); } } while (c != '\n'); for (int i = 0; i < cnt + 1; i++) { if (i != 0) cout << ' '; cout << solve(key[i], n) ; } return 0; }

Compilation message (stderr)

V.cpp: In function 'int main()':
V.cpp:28:10: error: 'getchar' was not declared in this scope
V.cpp:22:7: warning: unused variable 'in' [-Wunused-variable]
V.cpp:26:7: warning: unused variable 'str2' [-Wunused-variable]