• Source
    1. /**
    2. ********************************************
    3. This code only for beginners. Please, Don't Copy Past
    4. ********************************************
    5. **/
    6. // Uva 12592 solve: Slogan of Bangla
    7.  
    8. #include<stdio.h>
    9. #include<stdlib.h>
    10. #include<string.h>
    11. #include<math.h>
    12. #include<iostream>
    13. #include<queue>
    14. #include<stack>
    15. #include<string>
    16.  
    17. using namespace std;
    18.  
    19. int main()
    20. {
    21. int i,j,k, N;
    22. while(scanf("%d",&N)!=EOF){
    23. getchar();
    24. string a[30], b[30], tem;
    25. char ch[150];
    26.  
    27. for(i=0;i<N; i++){
    28. gets(ch);
    29. a[i].insert(0,ch);
    30. gets(ch);
    31. b[i].insert(0,ch);
    32. }
    33.  
    34. scanf("%d",&k);
    35. getchar();
    36.  
    37. for(i=0; i<k;i++){
    38. gets(ch);
    39. tem=""; // must do it
    40.  
    41. tem.insert(0,ch);
    42. for(j=0;j<N; j++){
    43. if( a[j].compare(tem)==0){
    44. cout<<b[j]<<endl;
    45. break;
    46. }
    47.  
    48. }
    49.  
    50. }
    51.  
    52. }
    53.  
    54. return 0;
    55.  
    56. }