Next Letter

AtCoder
IDcodefestival_2016_qualA_c
Time2000ms
Memory256MB
Difficulty
Mr. Takahashi has a string $s$ consisting of lowercase English letters. He repeats the following operation on $s$ exactly $K$ times. * Choose an arbitrary letter on $s$ and change that letter to the next alphabet. Note that the next letter of `z` is `a`. For example, if you perform an operation for the second letter on `aaz`, `aaz` becomes `abz`. If you then perform an operation for the third letter on `abz`, `abz` becomes `aba`. Mr. Takahashi wants to have the lexicographically smallest string after performing exactly $K$ operations on $s$. Find the such string. ## Constraints * $1≤|s|≤10^5$ * All letters in $s$ are lowercase English letters. * $1≤K≤10^9$ ## Input The input is given from Standard Input in the following format: $s$ $K$ [samples]
Samples
Input #1
xyz
4
Output #1
aya

For example, you can perform the following operations: `xyz`, `yyz`, `zyz`, `ayz`, `aya`.
Input #2
a
25
Output #2
z

You have to perform exactly $K$ operations.
Input #3
codefestival
100
Output #3
aaaafeaaivap
API Response (JSON)
{
  "problem": {
    "name": "Next Letter",
    "description": {
      "content": "Mr. Takahashi has a string $s$ consisting of lowercase English letters. He repeats the following operation on $s$ exactly $K$ times. *   Choose an arbitrary letter on $s$ and change that letter to th",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "codefestival_2016_qualA_c"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Mr. Takahashi has a string $s$ consisting of lowercase English letters. He repeats the following operation on $s$ exactly $K$ times.\n\n*   Choose an arbitrary letter on $s$ and change that letter to th...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments