Home > Back-end >  Take a look at the code is wrong in what place
Take a look at the code is wrong in what place

Time:10-03

# include
# include
# include
Void change (char a [200] [200])
{char b [200] [200].
Int [200] c={0};
Int line=sizeof (a)/sizeof (a [0]);
Int flag=0;
for(int i=0; i{strcpy (b [I], a [I]);
for(int j=0; j{
If (a [I] [j] <'A' | | A [I] [j] & gt; 'Z')
[I] {c==1;
break;
}}}

for(int i=0; i{
If (c [I]==0)
{
For (int j=I + 1; j{
If (c [j]==0)
{char \ [200].
If (STRCMP (b [I], [j] b & gt; 0))
{
Strcpy (temp, b [I]);
Strcpy (b [I], [j] b);
Strcpy (b [j], temp);
}

}
}
}
}


for(int i=0; iPrintf (" % s ", b [I]);
Printf (" % s \ n ", [] line - 1 b).

}

Void main ()
{
Int CNT.
The scanf (" % d ", & amp; CNT);
for(int i=0; i{int j=0;
Char a [200] [200].

[j] while (gets) (a))
{
If (STRCMP (a [j], "")==0 | | STRCMP (a [j]," \ n ")==0)
{
break;
}
j++;
}
Printf (" case # % d: \ n ");
Change (a [200] [200]).
}
}

CodePudding user response:

Given a sentence, a request to the character reordering output, one of the English letters in alphabet order output, the order of the other characters and position of the same, after the output word length is the same as the original sentence,
Input format

Line 1: an integer T (1 T or less 10 or less) as the question number,

2 ~ T + 1 line, each group of test data, including a string (length 200), by the English letters (both capital letters) and the other characters, separated by Spaces of continuous string as a word,
The output format

Output line for each problem, the problem of the serial number (0 number, format: case # 0, etc.), and then output after the reordering of strings in a line,
The sample
Input

3
THE BREAD IS SOLD AT $10 PER POUND
500 DONGCHUAN ROAD EAST CHINA NORMAL UNIVERSITY SHANGHAI CHINA 200241
# 9724 $500, 1234

The Output

Case # 0:
AAB DDDEE EH ILNO OP $10 PRR SSTTU
Case # 1:
500 AAAAAAAAC CCDD EEGG HHHHH IIIIIL MNNNNNNNOO ORRRSSST TUUVY 200241
Case # 2:
# 9724 $500, 1234

  • Related