Jump to content

java doubt


MysorePak

Recommended Posts

  • 2 weeks later...

Little Santa has made a list of all the nice children to whom he have to give the present. While getting ready to deliver the gifts he forgot where he kept the list. He remembered a string SS containing lowercase letters and stars ( * ). Star denotes that he didn't remember that letter of the string SS.

enter image description here

Little Santa is wondering what is the maximum number of names of the nice children in the list that can possibly match with the string SS if he will change at most one letter in the string SS to a star. String AA can possibly match with the string SS if letters on non star positions are equal. He is getting late to deliver the gifts so he asked you to solve this.

Note: All the names and the string SS will have same length.

Input format:
First line contains a string SS (1|S|3000)(1≤|S|≤3000), denoting the star string. SS only contains lowercase letters and stars ( * ). Second line contains an integer NN (1N3000)(1≤N≤3000), denoting the number of names on the list. Next NN lines contains a string each, stristri (1|stri|3000)(1≤|stri|≤3000), denoting the names of the children on the list. stristri consists of only lowercase letters.

Output format:
Print an integer denoting the maximum number of names of the nice children in the list that can possibly match with the string SS if he willchange at most one letter in the string SS to a star.

SAMPLE INPUT
 
 
a*c
3
abc
add
agd
SAMPLE OUTPUT
 
 
3
 

deeniki evaranna solution iyyanda please

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...