Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication55.cpp : This file contains the 'main' function. Program execution begins and ends there.
- //
- #include "pch.h"
- #include <iostream>
- #include <string>
- using namespace std;
- bool palindrom(int n, string w)
- {
- for (int i = 0; i < n/2; i++)
- if (w[i] != w[n - i - 1])
- return false;
- return true;
- }
- bool przesuniecie(int n, string w, int k)
- {
- string nowy = w;
- for (int i = 0; i < n; i++)
- nowy[i] = w[(i + k) % n];
- cout << nowy;
- return (palindrom(n, nowy));
- }
- int main()
- {
- int n, k;
- string txt;
- cin >> n >> txt >> k;
- //cout << palindrom(n, txt);
- cout << przesuniecie(n, txt, k);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement