PROGRAMMING:Array comprehensive application training
```
Complete the following operations according to multiple commands entered:
(1) I command: the input command is character I, followed by an integer n, and then enter n integers into the array.
(2) R command: the input command is the character R, which reverses the order of all elements in the array.
(3) A command: the input command is character a, the output array elements and the average value.
(4) S command: the input command is the character s, followed by an integer x, X is 1, all elements of the array
Sort from small to large, X is 2, and all elements of the array are sorted from large to small.
(5) P command: the input command is the character P, which outputs all elements in turn, with a space between the elements.
(4) U command: the input command is the character u, followed by an integer x to insert x into the tail of the array.
Note: all test data is guaranteed that the first command is I to initialize the array. Between different commands and data
Space or carriage return separation. All output commands occupy a single line. Please pay attention to the format of input and output samples.
```
###Input example:
```in
I 10 1 2 6 7 8 9 10 3 4 5
R P S 2 P S 1 P A
```
###Output example:
```out
5 4 3 10 9 8 7 6 2 1
10 9 8 7 6 5 4 3 2 1
1 2 3 4 5 6 7 8 9 10
Sum=55,Average=5.500000
```
###Input example:
```in
I 6 10 20 30 40 50 60
U 35 U 45 P A S 1 P
```
###Output example:
```out
10 20 30 40 50 60 35 45
Sum=290,Average=36.250000
10 20 30 35 40 45 50 60
```
answer:If there is no answer, please comment
Complete the following operations according to multiple commands entered:
(1) I command: the input command is character I, followed by an integer n, and then enter n integers into the array.
(2) R command: the input command is the character R, which reverses the order of all elements in the array.
(3) A command: the input command is character a, the output array elements and the average value.
(4) S command: the input command is the character s, followed by an integer x, X is 1, all elements of the array
Sort from small to large, X is 2, and all elements of the array are sorted from large to small.
(5) P command: the input command is the character P, which outputs all elements in turn, with a space between the elements.
(4) U command: the input command is the character u, followed by an integer x to insert x into the tail of the array.
Note: all test data is guaranteed that the first command is I to initialize the array. Between different commands and data
Space or carriage return separation. All output commands occupy a single line. Please pay attention to the format of input and output samples.
```
###Input example:
```in
I 10 1 2 6 7 8 9 10 3 4 5
R P S 2 P S 1 P A
```
###Output example:
```out
5 4 3 10 9 8 7 6 2 1
10 9 8 7 6 5 4 3 2 1
1 2 3 4 5 6 7 8 9 10
Sum=55,Average=5.500000
```
###Input example:
```in
I 6 10 20 30 40 50 60
U 35 U 45 P A S 1 P
```
###Output example:
```out
10 20 30 40 50 60 35 45
Sum=290,Average=36.250000
10 20 30 35 40 45 50 60
```
answer:If there is no answer, please comment