Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package TextProcessing;
- import java.util.Scanner;
- public class EncryptText_03 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- String text = scanner.nextLine(); //"Programming is cool!" -> ['P', 'r', 'o', ...]
- StringBuilder encryptedText = new StringBuilder(); //криптирания текст
- for (char symbol : text.toCharArray()) {
- //променям символа
- char newSymbol = (char) (symbol + 3);
- encryptedText.append(newSymbol); //encryptedText = encryptedText + newSymbol; -> бавна
- }
- System.out.println(encryptedText);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement