-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathall_alphs.java
More file actions
29 lines (29 loc) · 882 Bytes
/
Copy pathall_alphs.java
File metadata and controls
29 lines (29 loc) · 882 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
//write a java program to check whether if a string has all alphabetso
class AllAlpha
{
public static void main(String args[])
{
String str=new String("Farmer jack realized that big yellow quilts were expensive.");
int len=str.length();
int[] b=new int[26];
for(int i=0;i<26;i++)
System.out.print(b[i]+" ");
System.out.println(" ");
for (int i=0;i<len;i++)
{
char ch=str.charAt(i);
if(ch>='a' && ch<='z')
{
System.out.println((int)(ch-'a'));
b[(int)(ch-'a')]=1; // we can use b[(int)(ch-'a')]+=1 for counting the occurence.
}
else if(ch>='A' && ch<='Z')
{
System.out.println((int)(ch-'A'));
b[(int)(ch-'A')]=1;
}
}
for(int i=0;i<26;i++)
System.out.print(b[i]+" ");
}
}