【ECJTU_ACM 11级队员2012年暑假训练赛(7) - K - String Task】
2012-08-05 23:55
459 查看
K - String Task
Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u
Submit Status Practice CodeForces 118A
Description
Petya started to attend programming lessons. On the first lesson his task was to write a simple program. The program was supposed to do the following: in the given string, consisting if uppercase and lowercase Latin letters, it:
deletes all the vowels,
inserts a character "." before each consonant,
replaces all uppercase consonants with corresponding lowercase ones.
Vowels are letters "A", "O", "Y", "E", "U", "I", and the rest are consonants. The program's input is exactly one string, it should return the output as a single string, resulting after the program's processing the initial string.
Help Petya cope with this easy task.
Input
The first line represents input string of Petya's program. This string only consists of uppercase and lowercase Latin letters and its length is from 1 to 100, inclusive.
Output
Print the resulting string. It is guaranteed that this string is not empty.
Sample Input
Input
Output
Input
Output
Input
Output
Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u
Submit Status Practice CodeForces 118A
Description
Petya started to attend programming lessons. On the first lesson his task was to write a simple program. The program was supposed to do the following: in the given string, consisting if uppercase and lowercase Latin letters, it:
deletes all the vowels,
inserts a character "." before each consonant,
replaces all uppercase consonants with corresponding lowercase ones.
Vowels are letters "A", "O", "Y", "E", "U", "I", and the rest are consonants. The program's input is exactly one string, it should return the output as a single string, resulting after the program's processing the initial string.
Help Petya cope with this easy task.
Input
The first line represents input string of Petya's program. This string only consists of uppercase and lowercase Latin letters and its length is from 1 to 100, inclusive.
Output
Print the resulting string. It is guaranteed that this string is not empty.
Sample Input
Input
tour
Output
.t.r
Input
Codeforces
Output
.c.d.f.r.c.s
Input
aBAcAba
Output
.b.c.b
#include <iostream> using namespace std; char iMap[12] = {'A', 'a', 'Y', 'y', 'E', 'e', 'U', 'u', 'O', 'o', 'I', 'i'}; bool iInMap(char c) { bool yes = false; int flag = 11; while (!yes && flag >= 0) { if (iMap[flag] == c) { yes = true; } flag--; } return yes; } int main() { string s; while (cin >> s) { for (int i = 0; i < (int)s.length(); i++) { if (!iInMap(s[i])) { if (s[i] >= 'A' && s[i] <= 'Z') { s[i] += 32; } cout << "." << s[i]; } } cout << endl; } return 0; } // end // ism
相关文章推荐
- 【ECJTU_ACM 11级队员2012年暑假训练赛(7) - J - Union Set】
- 【ECJTU_ACM 11级队员2012年暑假训练赛(8) - H - Petya and Strings】
- 【ECJTU_ACM 11级队员2012年暑假训练赛(8) - I - Lucky Division】
- 【ECJTU_ACM 11级队员2012年暑假训练赛(8) - J - Word Problem】
- 【ECJTU_ACM 11级队员2012年暑假训练赛(8) - K - A short problem】
- 【A - ECJTU_ACM 11级队员2012年暑假训练赛(2)】
- 【B - ECJTU_ACM 11级队员2012年暑假训练赛(2)】
- 【ECJTU_ACM 11级队员2012年暑假训练赛(7)】
- 【C - ECJTU_ACM 11级队员2012年暑假训练赛(2)】
- 【ECJTU_ACM 11级队员2012年暑假训练赛(7) - A - Happy Telephones】
- 【D - ECJTU_ACM 11级队员2012年暑假训练赛(2)】
- 【ECJTU_ACM 11级队员2012年暑假训练赛(7) - B - Sliding Window】
- 【E - ECJTU_ACM 11级队员2012年暑假训练赛(2)】
- 【ECJTU_ACM 11级队员2012年暑假训练赛(7) - C - Fire Net】
- 【ECJTU_ACM 11级队员2012年暑假训练赛(8) - A - Paths on a Grid】
- 【F - ECJTU_ACM 11级队员2012年暑假训练赛(2)】
- 【ECJTU_ACM 11级队员2012年暑假训练赛(7) - D - Little Elephant and Rozdil】
- 【ECJTU_ACM 11级队员2012年暑假训练赛(8) - B - Modular Inverse】
- 【G - ECJTU_ACM 11级队员2012年暑假训练赛(2)】
- 【ECJTU_ACM 11级队员2012年暑假训练赛(7) - E - Little Elephant and Sorting】