Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)

Paste

Pasted as C++ by Mars ( 14 years ago )
#include "iostream"
#include "string"
using namespace std;


string s,s2;

string cod(string s,string p,char ch)
{
 string s1="";
 bool f=true;
 int i = 0;
 if(s.length() >= p.length())
 {
  
 for (i = 0; i <= s.length()-p.length(); i++)
 {f = true;
  for (int j=i; j < i+p.length();j++)
   if (s[j] != p[j-i]) f = false;
  if (f) 
  {
   
   i += p.length()-1;
   s1 += ch;
  } else s1 += s[i];
 }}
 for (i; i < s.length(); i++)
   s1 += s[i];
 return s1;
}


int main()
{
#ifndef ONLINE_JUDGE
   freopen("input.txt", "rt", stdin);
   freopen("output.txt", "wt", stdout);
#endif

   cout << "//CPP" << endl;
   cout << "#include<iostream>" << endl;
 cout << "#include \"string\"" << endl;
   cout << "using namespace std;" << endl;
 cout << "string s[] = {";
 int n=0,m=0;
 while (getline(cin,s))
 {
  if(m > 0) cout << ',' << endl;
         m++;
   s = cod(s,"\"",'=');
   s = cod(s,"th",'$');
   s = cod(s,"he",'<');
   s = cod(s,"in",'^');
   s = cod(s,"er",'@');
   //s = cod(s,"an",'~');
   s = cod(s,"re",'+');
   s = cod(s,"nd",'|');
   s = cod(s,"at",'>');
   s = cod(s,"on",'[');
  // s = cod(s,"nt",']');
   //s = cod(s,"ha",'*');
   //s = cod(s,"es",'в™Ђ');
   s = cod(s,"st",'/');
   //s = cod(s,"en",'&');
   //s = cod(s,"ed",'{');
  // s = cod(s,"to",'}');

   cout << "\"" << s << "\"";
   s2 = s;
 }
 if (s == "") 
 { 
  cout << endl; 
  cout << "\"" << s << "\"";
 }
 printf("};\n");
 printf("int main()\n");
 printf("{for(int i = 0; i < %d; i++)\n",m);
 printf("{for (int j = 0; j < s[i].length(); j++)\n");
  printf("if (s[i][j] == '$') printf(\"th\"); else\n");
  printf("if (s[i][j] == '<') printf(\"he\"); else\n");
  printf("if (s[i][j] == '^') printf(\"in\"); else\n");
  printf("if (s[i][j] == '@') printf(\"er\"); else\n");
  //printf("if (s[i][j] == '~') printf(\"an\"); //else\n");
  printf("if (s[i][j] == '+') printf(\"re\"); else\n");
  printf("if (s[i][j] == '|') printf(\"nd\"); else\n");
  printf("if (s[i][j] == '>') printf(\"at\"); else\n");
  printf("if (s[i][j] == '[') printf(\"on\"); else\n");
  //printf("if (s[i][j] == ']') printf(\"nt\"); //else\n");
  //printf("if (s[i][j] == '*') printf(\"ha\"); //else\n");
  
  printf("if (s[i][j] == '/') printf(\"st\"); else\n");
  //printf("if (s[i][j] == '&') printf(\"en\"); //else\n");
  //printf("if (s[i][j] == '{') printf(\"ed\"); //else\n");
  //printf("if (s[i][j] == '}') printf(\"to\"); //else\n");
  printf("if (s[i][j] == '=') cout << \"\\\"\"; else\n");
   printf("std::cout << s[i][j];\n");
   printf("if (i+1 < %d) printf(\"\\n\");}return 0;}",m);
 
 return 0;
}

 

Revise this Paste

Your Name: Code Language: