Photolog

Through the Looking-Glass
2010-10-12: Through the Looking-Glass
My radio speaks is binary!
2010-10-10: My radio speaks is binary!
Gigaminx: (present for my birthday)
2010-09-16: Gigaminx: (present for my birthday)
Trini on bike
2010-09-05: Trini on bike
Valporquero
2010-08-28: Valporquero
My new bike!
2010-08-22: My new bike!
Mario and Ana's wedding
2010-08-13: Mario and Ana's wedding
Canyoning in Guara
2010-08-07: Canyoning in Guara
Trini and Mari in Marbella
2010-08-05: Trini and Mari in Marbella
Trini and Chelo in Tabarca
2010-08-03: Trini and Chelo in Tabarca
Valid XHTML 1.1
Log in
Back to list of problems

Haiku Review

576.c

/* Haiku Review */
#include <stdio.h>
#include <string.h>

int
sil(char *s) {
	int i;
	int len = strlen(s);
	int num=0;

	for(i=0; i<len; i++) {
		if (strchr("aeiouy", s[i])) {
			num++;
			while (strchr("aeiouy", s[i])) {
				i++;
			}
		}
	}
	return num;
}

int
main(void) {
	char buf[1024];
	char word1[1024];
	char word2[1024];
	char word3[1024];

	while(fgets(buf, 1024, stdin)) {
		if (sscanf(buf, "%[^/]/%[^/]/%[^\r\n]", word1, word2, word3)!=3) {
			break;
		}
		if (!strcmp(word1,"e") && !strcmp(word2,"o") && !strcmp(word3,"i")) {
			break;
		}
		if (sil(word1)!=5) {
			printf("1\n");
		} else if (sil(word2)!=7) {
			printf("2\n");
		} else if (sil(word3)!=5) {
			printf("3\n");
		} else {
			printf("Y\n");
		}
	}
	exit(0);
}