Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
1.3 kB
4
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"};

        cin.sync();
        getline(cin,d);
         int num=0;int counter=0;int cd=0;
         string a;
         string b;
         string c;
    for(int i=0;i<d.length()-6;i=i+9)
    {
        a.push_back(d[i]);
        b.push_back(d[i+3]);
        b.push_back(d[i+2]);
        c.push_back(d[i+6]);
        c.push_back(d[i+5]);

        num=8*(static_cast<int>(b[cd])-static_cast<int>('0'))+4*(static_cast<int>(b[cd+1])-static_cast<int>('0'))+2*(static_cast<int>(c[cd])-static_cast<int>('0'))+1*(static_cast<int>(c[cd+1])-static_cast<int>('0'));
        if(a[counter]=='1')
        {
             num+=16;

        }
        if(i==0)
        {
            num+=26;
        }
        Ans[counter]=e[num];
        counter++;cd+=2;
        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