Garlic Cheat Whistleblower (application of String)

Source: Internet
Author: User

In view of the congestion in our city, the municipal traffic control department has been hearing the decision to place automatic parking charge system on both sides of the road. When the vehicle into the parking space, the system will be equipped with a camera to capture the vehicle image, by identifying the number of license plate, the letter sequence to identify the license plate, by connecting the DMV vehicle Information database to confirm the vehicle, the deduction fee.

The play of wits is generally started from here ...

Some owners can avoid the payment of parking fees by blocking one or more numbers and letters on the license plate while stopping the identification of the system.

Car owners This is simply a one-stop to get out a world puzzle has wood?! Management is on the one hand, the technical solution is the kingly ah.

Such a difficult project had to be handed over to the Garlic Guest lab. D God is responsible for identifying the color, E God is responsible for model identification, the possible license plate range is so little reduced. As an intern of garlic is also arduous task, will already exist in the vehicle database can match with the current known information to screen out the license plate information, this is the first step of the whole project AH, the importance I will not say more, come on.

Input

The first line of the input file contains a 9-character sequence of characters that represents the recognition.

The recognizable characters are displayed in uppercase letters and numbers, and "*" denotes characters that are not recognized because they are obscured.

The second line of the input file contains an integer n (1≤n≤1000)-The number of license plate information in the motor vehicle database.

Next n rows, containing the corresponding license plate information, one per line.

The license information is a string of length 9 that contains only numbers and uppercase letters. All license information is guaranteed to be different.

Output

The first behavior of the output file is an integer k (0≤k≤n)-the number of licenses that meet the given requirements.

The next K-line, output all possible license plate information.

Example 1

Input:

A**1mp19*4a001mp199e885ee098a111mp199kt7351ttb

Output:

2a001mp199a111mp199






1#include <iostream>2#include <stdio.h>3#include <string>4 using namespacestd;5 intMain ()6 {7     strings;8     stringa[ +];9     intc[ +];Ten     intFlag,n,i,j,count=0; One     intk=0; ACin>>s; -Cin>>N; -      for(i=0; i<n;i++) theCin>>A[i]; -      for(i=0; i<n;i++) -     { -flag=0; +          for(j=0;j<9; j + +) -         { +             if(s[j]!='*') A             { at                 if(s[j]!=A[i][j]) -                 { -flag=1; -                      Break; -                 } -  in             } -         } to         if(flag==0) +         { -count++; thec[k++]=i; *         }     $     }Panax Notoginsengcout<<count<<Endl; -          for(i=0; i<k;i++) thecout<<a[c[i]]<<Endl; +     return 0; A}

1#include <stdio.h>2#include <iostream>3#include <stdlib.h>4#include <string.h>5#include <string>6#include <algorithm>7 using namespacestd;8 intMain ()9 {Ten     Chars1[9],s2[9],s3[Ten]; One     Chars4[ +][Ten]; A     inti,n,m=0, k=0; - gets (S1); -     //GetChar (); thescanf"%d",&n); -     intp=N; - GetChar (); -      while(n--){ +memset (S3,0,sizeof(S3)); - gets (S2); +          for(i=0;i<9; i++){ A             if(s1[i]==S2[i]) { ats3[i]=S2[i]; -                 Continue; -             } -             Else if(s1[i]=='*'){ -s3[i]=S2[i]; -                 Continue; in             } -             Else{ toI=9; m++; +             } -         } thestrcpy (s4[k++],s3); *     } $cout<<p-m<<Endl;Panax Notoginseng      for(i=0; i<k;i++){ -         if(Strlen (s4[i]) = =9) thecout<<s4[i]<<Endl; +     } A     return 0; the}

Garlic Cheat Whistleblower (application of String)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.