Click Here to go back to the homepage.

Zebras and Ocelots Solution:


#include <stdio.h>
#include <stdlib.h>

int main(void) {
	int ctr = 0;
	scanf("%d\n", &ctr);
	char str[ctr], curr;
	for(int i = 0; i < ctr; i++){
		scanf("%c\n", &curr);
		str[i] = curr == 'Z' ? '0' : '1';
	}
	str[ctr] = '\0';
	printf("%ld", strtol(str, NULL, 2));
}