diff options
Diffstat (limited to 'inf/rtkš/1.c')
-rw-r--r-- | inf/rtkš/1.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/inf/rtkš/1.c b/inf/rtkš/1.c new file mode 100644 index 0000000..8b97d69 --- /dev/null +++ b/inf/rtkš/1.c @@ -0,0 +1,46 @@ +#include <stdio.h> +enum stanje { + nedefinirano, + cikcakast, + necikcakast_isti, + necikcakast_1, + necikcakast_2 +}; +enum stanje preveri (const char * n) { + int prevl = -1; + int prevprevl = -1; + int l = 1; + char c = *n++; + if (!c) + return nedefinirano; + while (1) { + if (*n != c) { + fprintf(stderr, "*n je %c, c je %c\n", *n, c); + if (l == prevl) + return necikcakast_isti; + if (prevprevl != -1 && prevl != -1) { + if (prevprevl < prevl) + if (l > prevl) + return necikcakast_1; + if (prevprevl > prevl) + if (l < prevl) + return necikcakast_2; + } + prevprevl = prevl; + prevl = l; + l = 1; + c = *n; + if (!*n) + return cikcakast; + n++; + } else { + l++; + n++; + } + } +} +int main (int argc, char ** argv) { + if (argc == 2) + return preveri(argv[1]); + return 255; +} |