-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathIsogramSt.java
More file actions
37 lines (29 loc) · 773 Bytes
/
IsogramSt.java
File metadata and controls
37 lines (29 loc) · 773 Bytes
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
import java.util.*;
// Given a string S of lowercase aplhabets, check if it is isogram or not.
// An Isogram is a string in which no letter occurs more than once.
public class IsogramSt {
public static void main(String args[]) {
Scanner s = new Scanner(System.in);
String str = s.nextLine();
isIso(str);
}
static void isIso(String str)
{
str = str.toLowerCase();
int len = str.length();
char arr[] = str.toCharArray();
Arrays.sort(arr);
for (int i = 0; i < len - 1; i++)
{
if (arr[i] == arr[i + 1])
{
System.out.println("No");
break;
}
else
{
System.out.println("Yes It is Isogram");
}
}
}
}