杭電oj-Vowel Counting
阿新 • • 發佈:2018-11-17
#include<stdio.h> #include<string.h> #include<stdlib.h> int main() { int T,first=1; char s[51],c; scanf_s("%d", &T); while (T--) { if(first) c = getchar(); first = 0; gets_s(s); for (int i = 0; i < strlen(s); i++) { if (s[i]>='a'&&s[i] <= 'z') { if (s[i]=='a'|| s[i] == 'e'|| s[i] == 'i'|| s[i] == 'o'|| s[i] == 'u') s[i] -= 32; } else { if (s[i]=='A'|| s[i] == 'E'|| s[i] == 'I'|| s[i] == 'O'|| s[i] == 'U'); else s[i] += 32; } } printf("%s\n", s); } system("pause"); return 0; }