-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path모음먼저알파벳순서중복제거.cpp
84 lines (79 loc) · 1.72 KB
/
모음먼저알파벳순서중복제거.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#include <ctype.h>
int main() {
/*
int T, len;
scanf("%d", &T);
char testcase[81];
while (T--) {
scanf("%s", testcase);
len = strlen(testcase);
for (int k = 0; k < 5; k++) {
for (int i = 0; i < len; i++) {
//¸ðÀ½Ã³¸®
if (testcase[i] == 'A' || testcase[i] == 'a') {
printf("%c", testcase[i]);
testcase[i] = 208;
}
if (testcase[i] == 'E' || testcase[i] == 'e') {
printf("%c", testcase[i]);
testcase[i] = 208;
}
if (testcase[i] == 'I' || testcase[i] == 'i') {
printf("%c", testcase[i]);
testcase[i] = 208;
}
if (testcase[i] == 'O' || testcase[i] == 'o') {
printf("%c", testcase[i]);
testcase[i] = 208;
}
if (testcase[i] == 'U' || testcase[i] == 'u') {
printf("%c", testcase[i]);
testcase[i] = 208;
}
}
}
for (int j = 1; j < 26; j++) {
for (int k = 0; k < len; k++) {
if (testcase[k] == j + 'A' || testcase[k] == j + 'a') {
printf("%c", testcase[k]);
}
}
}
printf("\n");
}*/
char mo_u[] = "AEIOU";
char mo_l[] = "aeiou";
int ntest, len, i, j;
char last_c = 0;
char str[81];
scanf("%d", &ntest);
while (ntest--) {
scanf("%s", str);
len = strlen(str);
for (i = 0; i <= 25; i++) {
for (j = 0; j < len; j++) {
if (str[j] == 'A' + i || str[j] == 'a' + i) {
if (toupper(str[j]) != toupper(last_c)) {
putchar(str[j]);
last_c = str[j];
}
}
}
}
for (i = 0; i < 5; i++) {
for (j = 0; j < len; j++) {
if (str[j] == mo_u[i] || str[j] == mo_l[i]) {
if (toupper(str[j]) != toupper(last_c)) {
putchar(str[j]);
last_c = str[j];
}
str[j] = '\0';
}
}
}
printf("\n");
}
}