Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- class DelThree{
- public static void main(String[] args){
- Scanner sc = new Scanner(System.in);
- String[] a = new String[5];
- int i, j;
- for(i = 0; i < 5; i++){
- System.out.print("Enter a String: ");
- a[i] = sc.nextLine();
- a[i] = a[i].substring(3,a[i].length());
- }
- for(i = 1; i<a.length; i++){
- String temp = a[i];
- for(j = i-1; j>=0 && temp.compareToIgnoreCase(a[j])>0; j--) a[j+1] = a[j];
- a[j+1] = temp;
- }
- for(i = 0; i < 5; i++) System.out.println(a[i]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement