Created
January 20, 2018 09:11
-
-
Save danieldsf/0742b157f4c9e08f4e97dc9ae0aeb778 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
char set[] = {'<', '2', '>', '[', 'C','A', 'T', 'A', 'R', 'I', 'N', 'A' ,']'}; | |
int position = 0; | |
char charByChar(){ | |
if(position < 13){ | |
position++; | |
return set[position-1]; | |
} | |
return ' '; | |
} | |
void disjoinFlagAndName(){ | |
char map = ' '; | |
int started_name, started_flag; | |
started_name = started_flag = 0; | |
char flag = '0'; | |
do{ | |
map = charByChar(); | |
if(map == '<') | |
started_flag = 1; | |
else if(started_flag){ | |
if(map == '>') | |
started_flag = 0; | |
else{ | |
flag = map; | |
printf("%c\n", flag); | |
if(flag == '0' || flag == '2'){return;} | |
} | |
} | |
else if(map == '[') | |
started_name = 1; | |
else{ ///if(started_name){ | |
if(map == ']') | |
started_name = 0; | |
else | |
printf("%c", map); | |
} | |
}while(map != ' '); | |
printf("\n"); | |
} | |
int main(){ | |
printf("Starting...\n"); | |
disjoinFlagAndName(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment