How to learn this language

From Esolang
Jump to navigation Jump to search

Introduction

How to learn this language is a joke language.

Actually, the name of the language is of infinity length. You can use "How to learn this language" to replace the "this language" in the name. So How to learn "How to learn this language", How to learn "How to learn 'How to learn this language'", etc. are all correct names for the language.

Commands

There are 3 commands in the language.

i: input a string.

o: output the char on it's right. (Actually except for the char 'i' 'o' and 'q')

q: run the program.

Example

Hell0, w0rld!

oHoeololo0o,o owo0orolodo!

0 Interpreter

io0

6 Interpreter

io6

Cat

oi

Output input.

Output the name of the language (IN CAPITAL, Without the quotation mark)

oHoOoWo oToOo oLoEoAoRoNq

First, output "How to learn". Then, output "How to learn". Then, output "How to learn". Then, output "How to learn"......

Interpreter

C++

#include <bits/stdc++.h>
using namespace std;
#define int long long
string code, input;

signed main() {
	getline(cin, code);
label:
	for (int i = 0; i < code.size(); i++) {
		if (code[i] == 'o') {
			if (code[i + 1] != 'i' && code[i + 1] != 'o' && code[i + 1] != 'q')
				cout << code[i + 1];
			if (code[i + 1] == 'i') {
				cin >> input;
				cout << input << endl;
			}
		}
		if (code[i] == 'q') {
			goto label;
		}
		if (code[i] == 'i' && code[i - 1] != 'o') {
			cin >> input; // actually this is no use
		}
	}
	return 0;
}

See also