HOJ_first_homework_F

HOJ_first_homework_F_第1张图片

#include 
int main () {
	int c[100000];
	int i = 0;
	while ((c[i] = getchar()) != EOF) {
		i++;
	}
	int j;
	for (j = 0; j < i - 1; j++) {
		if (c[j] == 105 && c[j + 1] == 103) {
			c[j + 1] -= 32;
		}else if (c[j] == 73 && c[j + 1] == 71) {
			c[j] += 32;
		}else if (c[j] == 73 && c[j + 1] == 103) {
			c[j] += 32;
			c[j + 1] -= 32;
		}
	}
	for (j = 0; j < i; j++) {
		printf("%c", c[j]);
	}
	return 0;
}

你可能感兴趣的:(homework)