Ganesh1648

Constellation

Aug 8th, 2020
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.32 KB | None | 0 0
  1. #include <iostream>
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4.  
  5. #define pb push_back
  6. #define forn(i, n) for (int i = 0; i < n; i++)
  7. #define ll long long
  8. #define endl "\n"
  9.  
  10. const int N =1e5+1;
  11. void solve()
  12. {
  13.     int n;
  14.     cin>>n;
  15.     char c[3][n];
  16.     for(int i=0;i<3;i++)
  17.         for(int j=0;j<n;j++)
  18.             cin>>c[i][j];
  19.    
  20.     unordered_map<string,char> ma;
  21.     ma[".*.****.*"]='A';
  22.     ma["*********"]='E';
  23.     ma["***.*.***"]='I';
  24.     ma["****.****"]='O';
  25.     ma["*.**.****"]='U';
  26.     string ans;
  27.     int inc=1;
  28.     for(int i=0;i<n;i+=inc)
  29.     {
  30.         if(i+2>=n || c[0][i]=='#')
  31.         {
  32.             inc=1;
  33.             ans+="#";
  34.         }
  35.         else
  36.         {
  37.             string temp;
  38.             temp+=c[0][i];
  39.             temp+=c[0][i+1];
  40.             temp+=c[0][i+2];
  41.             temp+=c[1][i];
  42.             temp+=c[1][i+1];
  43.             temp+=c[1][i+2];
  44.             temp+=c[2][i];
  45.             temp+=c[2][i+1];
  46.             temp+=c[2][i+2];
  47.             if(ma.count(temp)){
  48.                 ans+=ma[temp];
  49.                 inc=3;
  50.             }
  51.             else{
  52.                 ans+="#";
  53.                 inc=1;
  54.             }
  55.         }
  56.     }
  57.     cout<<ans<<endl;
  58. }
  59. int main()
  60. {
  61.     ios_base::sync_with_stdio(false);
  62.     cin.tie(NULL);
  63.     cout.tie(NULL);
  64.     solve();
  65. }
Advertisement
Add Comment
Please, Sign In to add comment