15: Name and 15

Source: Internet
Author: User

15: Name and 15
15: sort the pharmaceutical name

  • View
  • Submit
  • Statistics
  • Question
Total time limit:
1000 ms
 
Memory limit:
65536kB
Description

When writing the name of a drug, doctors often do not pay attention to Case sensitivity and the format is messy. Now, you are required to write a program to organize the chaotic drug names written by doctors into a unified and standardized format, that is, if the first character of the drug name is in uppercase, the other letters are in lowercase. For example, sort ASPIRIN and aspirin into Aspirin.

Input
The number n in the first line indicates that there are n drug names to be sorted, and n cannot exceed 100.
In the next n rows, each line contains one word and the length cannot exceed 20, indicating the name of the medicine in the doctor's Hand Book. The drug name consists of letters, numbers, and.
Output
N rows, one word per line, corresponding to the standard writing of the entered drug name.
Sample Input
4AspiRincisapride2-PENICILLINCefradine-6
Sample output
AspirinCisapride2-penicillinCefradine-6
Source
Exercise (7-8) Medical Science Department 2010 final questions Ji Jiarui
 1 #include <cstdio> 2 #include <iostream> 3 #include <cstring> 4 using namespace std; 5 char a[10001]; 6 int now; 7 char b[1001][1001]; 8 int main() 9 {10     int n;11     cin>>n;12     for(int i=0;i<=n;i++)13     {14         gets(a);15         int l=strlen(a);16         if(a[0]>='a'&&a[0]<='z')17         {18             a[0]=a[0]-32;19         }20             for(int i=1;i<=l;i++)21             {22                 if(a[i]>='A'&&a[i]<='Z')a[i]=a[i]+32;23             }24         for(int i=0;i<=l;i++)25         {26             b[now][i]=a[i];27         }28         now++;29     }30     for(int i=1;i<=n;i++)31     {32         puts(b[i]);33     }34 return 0;35 }

 

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.