Maurice Tutor

(5)

$15/per page/Negotiable

About Maurice Tutor

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Algebra,Applied Sciences See all
Algebra,Applied Sciences,Biology,Calculus,Chemistry,Economics,English,Essay writing,Geography,Geology,Health & Medical,Physics,Science Hide all
Teaching Since: May 2017
Last Sign in: 398 Weeks Ago, 2 Days Ago
Questions Answered: 66690
Tutorials Posted: 66688

Education

  • MCS,PHD
    Argosy University/ Phoniex University/
    Nov-2005 - Oct-2011

Experience

  • Professor
    Phoniex University
    Oct-2001 - Nov-2016

Category > Computer Science Posted 15 Sep 2017 My Price 7.00

Problem description

Problem description

There are often situation at the college when people have to prove themselves to the teacher infront of the whole class.
Once a boy named pankaj was the center of attack.
The teacher gave him a string S consisting of alphabets ( a-z ) and dots ( . ) and asked him to enumerate the strings by filling the dots with alphabets from a-z, such that

    • abs(S[i] - S[i - 1]) = d for i > 0 and for some given d

 

  • a = S[i] = z for i = 0

Attendance for 2 classes are on stake for him. Help him save his attendance by answering the question.

As the answer might be large, output the answer modulus 10^9 + 7.

Input

Input description

  • The first line of the input contains an integer T denoting the number of test cases. The description of T test cases follows.
  • The first line of each test case contains the string S followed by second line containing the number d

 

Output

Output description

  • For each test case, output a single line containing the answer.

 

Constraints

  • 1 = T = 10
  • 1 = length(s) = 10^5

 

Example

Input 2 a. 1 .. 2 Output 2 124

 

Explanation

Example case 1. The only way to fill the second place is with 'a' or 'b'

Answers

(5)
Status NEW Posted 15 Sep 2017 11:09 PM My Price 7.00

Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll

Not Rated(0)