Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class HelloWorld {
- static void Main() {
- int [] Cookie = new int [255];
- int WhichCookie, HML, digitIn, digitInLoop;
- bool BGC, FGC, isZero;
- string action, action2;
- action = Console.ReadLine();
- BGC = false;
- FGC = false;
- digitIn = 0;
- HML = 0;
- foreach (char x in action) {
- digitIn++;
- if (Cookie[WhichCookie] == 0) {
- isZero = true;
- } else {
- isZero = false;
- }
- switch (x) {
- case '+':
- Cookie[WhichCookie]++;
- break;
- case '-':
- Cookie[WhichCookie]--;
- break;
- case '>':
- WhichCookie++;
- break;
- case '<':
- WhichCookie--;
- break;
- case '.':
- Console.Write(char.ConvertFromUtf32(Cookie[WhichCookie]));
- break;
- case '[':
- if (!(isZero)) {
- action2 = action.substring(digitIn);
- do {
- digitInLoop = 0;
- foreach (char y in action2) {
- digitInLoop++;
- switch (y) {
- case '[':
- HML++;
- break;
- case ']':
- HML--;
- if (HML == -1) {
- action2 = action2.substring(digitInLoop);
- }
- break;
- case '+':
- Cookie[WhichCookie]++;
- break;
- case '-':
- Cookie[WhichCookie]--;
- break;
- case '>':
- WhichCookie++;
- break;
- case '<':
- WhichCookie--;
- break;
- case '.':
- Console.Write(char.ConvertFromUtf32(Cookie[WhichCookie]));
- break;
- case '?':
- Cookie[WhichCookie] += 10;
- break;
- case '!':
- Cookie[WhichCookie] -= 10;
- break;
- case '$':
- Cookie[WhichCookie] += 5;
- break;
- case '#':
- Cookie[WhichCookie] -= 5;
- break;
- case '~':
- Cookie[WhichCookie] = 0;
- break;
- case '/':
- Console.Write(Cookie[WhichCookie]);
- break;
- }
- }
- } while (!isZero);
- }
- break;
- case '?':
- Cookie[WhichCookie] += 10;
- break;
- case '!':
- Cookie[WhichCookie] -= 10;
- break;
- case '$':
- Cookie[WhichCookie] += 5;
- break;
- case '#':
- Cookie[WhichCookie] -= 5;
- break;
- case '~':
- Cookie[WhichCookie] = 0;
- break;
- case '/':
- Console.Write(Cookie[WhichCookie]);
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement