Created
March 26, 2015 19:48
-
-
Save zsrinivas/546ca7fe7e624fab615a to your computer and use it in GitHub Desktop.
codeforces #297 B. Pasha and String
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- encoding: utf-8 -*- | |
# pylint: disable=invalid-name,missing-docstring,bad-builtin | |
def main(): | |
s = list(raw_input()) | |
n = len(s) | |
m = int(raw_input()) | |
arr = map(int, raw_input().split()) | |
arr.sort() | |
k = 0 | |
for x in xrange(n // 2): | |
while k < m and arr[k] - 1 <= x: | |
k += 1 | |
if k % 2: | |
s[x], s[n - x - 1] = s[n - x - 1], s[x] | |
print ''.join(s) | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment