9625. toUpperCase
One line of
characters is given. Convert all LowerCase letters of the English
alphabet to UpperCase.
Input. One line of no more
than 100 characters.
Output. Print the same line of characters, where all
LowerCase letters of the English alphabet are converted to UpperCase.
Sample
input |
Sample
output |
"Hi! Cat, dog & mouse" - girl. |
"HI! CAT, DOG & MOUSE" - GIRL. |
strings
Use the function toupper, which converts
characters to uppercase.
Algorithm realization
Declare a char
array.
char s[101];
Read the
input string.
gets(s);
Convert all
characters in the string to uppercase.
for (i = 0; i < strlen(s); i++)
s[i] =
toupper(s[i]);
Print the
answer.
puts(s);
Algorithm realization
– C++
Read the
input string.
getline(cin, s);
Convert all
characters in the string to uppercase.
for (int i = 0; i < s.size(); i++)
s[i] = toupper(s[i]);
Print the
answer.
cout << s << endl;
Java realization
import java.util.*;
public class Main
{
public static void main(String[] args)
{
Scanner con = new
Scanner(System.in);
String s = con.nextLine();
s = s.toUpperCase();
System.out.println(s);
con.close();
}
}
Python realization
print(input().upper())