Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Pet_Pet_B {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- char[] array = sc.nextLine().toCharArray();
- punctuation(array);
- }
- public static void punctuation(char[] array) {
- for (int i = array.length - 1; i >= 0; --i) {
- if (Character.isLowerCase(array[i]))
- System.out.print(Character.toUpperCase(array[i]));
- else if (Character.isUpperCase(array[i]))
- System.out.print(Character.toLowerCase(array[i]));
- else if (Character.isDigit(array[i]))
- System.out.print(Character.getNumericValue(array[i]) * 2);
- else {
- switch (array[i]) {
- case ' ':
- case '!':
- case '#':
- case '%':
- case '&':
- case '(':
- case ')':
- case '*':
- case '-':
- case '.':
- case ':':
- case ',':
- case '?':
- case '@':
- case '[':
- case ']':
- case '_':
- case '{':
- case '}':
- System.out.print(".");
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement