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 }