1004: Uppercase of characters to lowercase time limit:1 Sec Memory limit:128 MB
submit:712 solved:205
Description
String processing problem is a part of the program design, careful and good RP is the key to the topic of your AC ^_^!
The meaning of the topic is very simple, for each input string (length less than 80 characters), for each of the characters, if it is an uppercase English letter, convert it to lowercase output, if it is lowercase letters, left as lowercase, if not letters, then replace ' * ' (asterisk) and output.
Input for each behavior of the string to be tested, length <80output
Output the appropriate content according to the above rules, one row for each output. That way, you'll see the ^_^ of the Accept string!
Sample Input
ABCDAC 2015!
Sample Output
abcdac******
[Train of thought] according to the character table, the characters within the value of not more than 128, we open a larger array, and then initialize the tables, the direct output is good.
Code
1#include <iostream>2#include <string>3#include <cmath>4#include <cstdio>5#include <cstring>6 7 using namespacestd;8 Chars[ the];9 Ten voidInit () One { A for(inti =0; I < the; i++) S[i] ='*'; - for(inti ='a'; I <='Z'; i++) S[i] =Char(i); - for(inti ='A'; I <='Z'; i++) S[i] =Char(i + +); the return ; - } - - intMain () + { - init (); + Char inch[10000]; A while(Gets (inch)) at { - for(inti =0; I < strlen (inch) ; i++) cout << s[inch[i]]; -cout <<Endl; - } - return 0; -}
[1004] Uppercase and lowercase characters