-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDay11_prob1.java
More file actions
52 lines (38 loc) · 1.33 KB
/
Day11_prob1.java
File metadata and controls
52 lines (38 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
Peter is teaching ABCD.. to his younger brother through a game. The rules of the game include peter speaking 2 characters, and expecting his brother to speak all the alphabets in between based on the following conditions.
The two characters should be alphabets, in either case.
First alphabet should be smaller.
In all other cases ERROR should be displayed.
Input Format
two alphabets as input
Constraints
The two characters should be alphabets, in either case.
First alphabet should be smaller.
In all other cases ERROR should be displayed.
Output Format
Aplhabets in between or ERROR.
Sample Input 0
H X
Sample Output 0
H I J K L M N O P Q R S T U V W X
*/
// kirtan jain
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
Scanner sc = new Scanner(System.in);
char a = sc.next().charAt(0);
char b = sc.next().charAt(0);
// System.out.println(a+" "+b);
if(((a>='a' && a<='z') || (a>='A' && a<='Z')) && ((b>='a' && b<='z') || (b>='A' && b<='Z'))){
for(char i=a;i<=b;i++){
System.out.print(i+" ");
}
}
else{
System.out.print("ERROR");
}
}
}