Advertisement
Guest User

Untitled

a guest
Oct 15th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. #include<iostream>
  2. #include<cstring>
  3. #include<cstdio>
  4.  
  5. using namespace std;
  6.  
  7. class String
  8. {
  9.  
  10. public:
  11. char word[11];
  12. };
  13.  
  14. int main()
  15. {
  16. int n,m;
  17. String w[3000][2], lec[3000];
  18. cin>>n>>m;
  19.  
  20. if(n<1 || n>3000) return 0;
  21. if(m<1 || m>3000) return 0;
  22.  
  23. for(int i=0; i<m; i++)
  24. {
  25. for(int j=0; j<2; j++)
  26. {
  27. scanf("%s", w[i][j].word);
  28. }
  29. }
  30.  
  31. for(int i=0; i<n; i++)
  32. {
  33. scanf("%s", lec[i].word);
  34.  
  35. for(int k=0; k<m; k++)
  36. {
  37. if(!(strcmp(lec[i].word, w[k][0].word)) || !(strcmp(lec[i].word, w[k][1].word)))
  38. {
  39. if(strlen(w[k][0].word)>strlen(w[k][1].word)) cout<<w[k][1].word<<" ";
  40. else cout<<w[k][0].word<<" ";
  41. }
  42.  
  43. }
  44. }
  45.  
  46. return 0;
  47.  
  48.  
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement