Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- /*
- Amon Guinan
- Friday Jan, 2019
- User inputs a 10 letter string.
- Program outputs every letter with odd index.
- */
- public class Sixty_Seven {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- System.out.print("Please input an encrypted message that's 10 letters long:");
- String phrase = input.nextLine();
- if(phrase.length() != 10)
- {
- System.out.print("Please enter a 10 character long string.");
- System.exit(2);
- }
- String newphrase = phrase.substring(0,1)+phrase.substring(2,3)+phrase.substring(4,5)+phrase.substring(6,7)+phrase.substring(8,9)+phrase.substring(10);
- System.out.print(newphrase);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement