Advertisement
Saleh127

UVA 11233

Jul 19th, 2021
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define test int tt; cin>>tt; for(int cs=1;cs<=tt;cs++)
  5. int main()
  6. {
  7. ios_base::sync_with_stdio(0);
  8. cin.tie(0);cout.tie(0);
  9.  
  10. ll n,m,i,j,k,l;
  11.  
  12. string a,b;
  13.  
  14. map<string,string>x;
  15.  
  16. cin>>n>>m;
  17.  
  18. while(n--)
  19. {
  20. cin>>a>>b;
  21. x[a]=b;
  22. }
  23. while(m--)
  24. {
  25. cin>>a;
  26.  
  27. if(x[a]!="") cout<<x[a]<<endl;
  28. else
  29. {
  30. l=a.size()-1;
  31.  
  32. if(a[l]=='y' && (a[l-1]!='a' && a[l-1]!='e' && a[l-1]!='i' && a[l-1]!='o' && a[l-1]!='u'))
  33. {
  34. a[l]='i';
  35. a+="es";
  36. }
  37. else if(a[l]=='o' || a[l]=='s' || a[l]=='x' || (a[l]=='h' && a[l-1]=='c') || (a[l]=='h' && a[l-1]=='s'))
  38. {
  39. a+="es";
  40. }
  41. else a+="s";
  42.  
  43.  
  44. cout<<a<<endl;
  45. }
  46. }
  47.  
  48.  
  49. return 0;
  50. }
  51.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement