Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(){
- int tc;
- scanf("%d",&tc);
- for(int i=1;i<=tc;i++){
- int n,count;
- bool flag = false;
- scanf("%d",&n);
- char data[n][101];
- int length[n];
- for(int j=0;j<n;j++){
- scanf("%d %s",&length[j],&data[j]);
- }
- int inputLength;
- scanf("%d",&inputLength);
- char input[inputLength+1];
- scanf(" %s",input);
- for(int j=0;j<n;j++){
- count = 0;
- if(inputLength==length[j]){
- for(int k=0;k<inputLength;k++){
- if(input[k]!=data[j][k]){
- count++;
- }
- if(count>1){
- break;
- }
- if(count<2 && k==inputLength-1){
- flag = true;
- }
- }
- }
- }
- if(flag){
- printf("Case #%d: yes\n",i);
- }else{
- printf("Case #%d: no\n",i);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement