[1004] Uppercase and lowercase characters

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.