Problem:
Score : 400 points

Problem Statement

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

Output

Print the lexicographically smallest string after performing exactly K operations on s.

Sample Input 1

xyz
4

Sample Output 1

aya

For example, you can perform the following operations: xyz, yyz, zyz, ayz, aya.

Sample Input 2

a
25

Sample Output 2

z

You have to perform exactly K operations.

Sample Input 3

codefestival
100

Sample Output 3

aaaafeaaivap

Solution in C# (Mono 4.6.2.0) (judge verdict: Wrong Answer)

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Math;
using static System.Console;


class Program
{
    static void Main()
    {
        string S = ReadStr();
        int K = ReadInt();

        for (int i = 0; i < S.Length; i++)
        {
            char c = S[i];
            if (K >= 'z' - c + 1)
            {
                S = ReplaceOneChar(S, i, "a");
                K -= 'z' - c + 1;
            }
        }

        //余ったK
            char newChar = (char)(S[S.Length - 1] + K);
            S = ReplaceOneChar(S, S.Length - 1, newChar.ToString());
        

        WriteLine(S);
        ReadLine();
        return;
    }

    private static string ReplaceOneChar(string S, int index, string newS)
    {
        string s1 = S.Substring(0, index);
        string s2 = S.Substring(index+1);
        return s1 + newS + s2;
    }

    #region Reader
    static string ReadStr()
    {
        return Console.ReadLine();
    }
    static string[] ReadStrN()
    {
        return Console.ReadLine().Split(' ');
    }
    static int ReadInt()
    {
        return Convert.ToInt32(Console.ReadLine());
    }
    static int[] ReadIntN()
    {
        return Console.ReadLine().Split(' ').Select(s => Convert.ToInt32(s)).ToArray();
    }
    static long ReadLong()
    {
        return Convert.ToInt64(Console.ReadLine());
    }
    static long[] ReadLongN()
    {
        return Console.ReadLine().Split(' ').Select(s => Convert.ToInt64(s)).ToArray();
    }
    static long[,] ReadLongMatrix(int r, int c)
    {
        var mat = new long[r, c];
        for (int i = 0; i < r; ++i)
        {
            var x = ReadLongN();
            for (int j = 0; j < c; ++j)
            {
                mat[i, j] = x[j];
            }
        }
        return mat;
    }
    static Tuple<string, string>[] ReadTupleStr(int n)
    {
        List<Tuple<string, string>> list = new List<Tuple<string, string>>();
        for (int i = 0; i < n; ++i)
        {
            var ab = ReadStrN();
            list.Add(new Tuple<string, string>(ab[0], ab[1]));
        }
        return list.ToArray();
    }
    static Tuple<long, long>[] ReadTupleLong(int n)
    {
        List<Tuple<long, long>> list = new List<Tuple<long, long>>();
        for (int i = 0; i < n; ++i)
        {
            var ab = ReadLongN();
            list.Add(new Tuple<long, long>(ab[0], ab[1]));
        }
        return list.ToArray();
    }
    static Tuple<int, int>[] ReadTupleInt(int n)
    {
        List<Tuple<int, int>> list = new List<Tuple<int, int>>();
        for (int i = 0; i < n; ++i)
        {
            var ab = ReadIntN();
            list.Add(new Tuple<int, int>(ab[0], ab[1]));
        }
        return list.ToArray();
    }
    static Tuple<double, double>[] ReadTupleDouble(int n)
    {
        List<Tuple<double, double>> list = new List<Tuple<double, double>>();
        for (int i = 0; i < n; ++i)
        {
            var ab = ReadLongN();
            list.Add(new Tuple<double, double>(ab[0], ab[1]));
        }
        return list.ToArray();
    }
    static Dictionary<int, HashSet<int>> ReadAdjacencyList(int N, int M)
    {
        Dictionary<int, HashSet<int>> dict = new Dictionary<int, HashSet<int>>();
        for (int i = 0; i <= N; ++i)
        {
            dict.Add(i, new HashSet<int>());
        }
        for (int i = 0; i < M; ++i)
        {
            var ab = ReadIntN();
            dict[ab[0]].Add(ab[1]);
            dict[ab[1]].Add(ab[0]);
        }
        return dict;
    }
    #endregion

}