Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
1.1 kB
2
Indexable
Never
#include <iostream>
#include <string>
#include <vector>
using namespace std;


int main()
{
        int i=0;int x;

         string d;
         string Ans;
         string e={" ,.!?-zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA"};
         long long int num=0;int counter=0;
         string a;
         string b;
         string c;
    while(cin>>a>>b>>c)
    {

        num=8*(static_cast<int>(b[1])-static_cast<int>('0'))+4*(static_cast<int>(b[0])-static_cast<int>('0'))+2*(static_cast<int>(c[1])-static_cast<int>('0'))+1*(static_cast<int>(c[0])-static_cast<int>('0'));

        if(a[counter]=='1')
        {
             num+=16;
        }
        if(i==0)
        {
            num+=26;
        }
        Ans[counter]=e[num];
        counter++;
        if(i>2&&Ans[i-2]=='.'||Ans[i-2]=='?'||Ans[i-2]=='!')//period, ? etc
        {
            num=26;
        }
        else
        {
            num=0;
        }
    }

        for(int z=0;z<counter;z++)
        {
            cout<<Ans[z];
        }
        return 0;
}

Leave a Comment