STRING ARRAY PROGRAMS
import java.util.*;
class PROGRAM1
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("enter the size of the array...");
int n=sc.nextInt();
// sc.nextLine();
String a[]=new String[n];
for(int i=0;i<n;i++)
a[i]=sc.nextLine();
System.out.println("The output is ::");
for(int i=0;i<n;i++)
{
char ch=a[i].charAt(0);
if(ch=='A'||ch=='a')
System.out.println(a[i]);
}
}
}
import java.util.*;
class PROGRAM2
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("enter the size of the array...");
int n=sc.nextInt();
sc.nextLine();
String a[]=new String[n];
for(int i=0;i<n;i++)
a[i]=sc.nextLine();
System.out.println("The output is ::");
for(int i=0;i<n;i++)
{
char ch=a[i].charAt(0);
char chr=a[i].charAt(a[i].length()-1);
if((ch=='A'||ch=='a')&&(chr=='A'||chr=='a'))
System.out.println(a[i]);
}
}
}
import java.util.*;
class PROGRAM3
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("enter the size of the array...");
int n=sc.nextInt();
sc.nextLine();
String a[]=new String[n];
for(int i=0;i<n;i++)
a[i]=sc.nextLine();
System.out.println("The output is ::");
for(int i=0;i<n;i++)
{
if(a[i].length()%2==0)
System.out.println(a[i]);
}
}
}
import java.util.*;
class PROGRAM4
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("enter the size of the array...");
int n=sc.nextInt();
sc.nextLine();
String a[]=new String[n];
for(int i=0;i<n;i++)
a[i]=sc.nextLine();
System.out.println("The output is ::");
for(int i=0;i<n;i++)
{
char ch=a[i].charAt(0);
char chr=a[i].charAt(a[i].length()-1);
if(ch==chr)
System.out.println(a[i]);
}
}
}
import java.util.*;
class PROGRAM5
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("enter the size of the array...");
int n=sc.nextInt();
sc.nextLine();
String a[]=new String[n];
for(int i=0;i<n;i++)
a[i]=sc.nextLine();
System.out.println("The output is ::");
for(int i=0;i<n;i++)
{
String s=a[i].substring(0,3);
if(s.equals("SRI"))
System.out.println(a[i]);
}
}
}
import java.util.*;
class PROGRAM6
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("enter the size of the array...");
int n=sc.nextInt();
sc.nextLine();
String a[]=new String[n];
for(int i=0;i<n;i++)
a[i]=sc.nextLine();
System.out.println("The output is ::");
for(int i=0;i<n;i++)
{
if(a[i].startsWith("SRI"))
System.out.println(a[i]);
}
}
}
import java.util.*;
class PROGRAM7
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("enter the size of the array...");
int n=sc.nextInt();
sc.nextLine();
String a[]=new String[n];
for(int i=0;i<n;i++)
a[i]=sc.nextLine();
System.out.println("The output is ::");
for(int i=0;i<n;i++)
{
if((a[i].startsWith("A") ||a[i].startsWith("a")) && (a[i].endsWith("A") ||
a[i].endsWith("a")))
System.out.println(a[i]);
}
}
}
import java.util.*;
class PROGRAM8
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("enter the size of the array...");
int n=sc.nextInt();
sc.nextLine();
String a[]=new String[n];
for(int i=0;i<n;i++)
a[i]=sc.nextLine();
System.out.println("The output is ::");
for(int i=0;i<n;i++)
{
String s=a[i];
String rev="";
for(int j=0;j<s.length();j++)
{
char ch=s.charAt(j);
rev=ch+rev;
}
if(rev.equals(s))
System.out.println(a[i]);
}
}
}
import java.util.*;
class PROGRAM9
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("enter the size of the array...");
int n=sc.nextInt();
sc.nextLine();
String a[]=new String[n];
for(int i=0;i<n;i++)
a[i]=sc.nextLine();
System.out.println("The output is ::");
for(int i=0;i<n;i++)
{
char ch=a[i].charAt(0);
char chr=a[i].charAt(a[i].length()-1);
if(Character.isUpperCase(ch) && Character.isUpperCase(chr))
System.out.println(a[i]);
}
}
}
import java.util.*;
class PROGRAM10
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("enter the size of the array...");
int n=sc.nextInt();
sc.nextLine();
String a[]=new String[n];
for(int i=0;i<n;i++)
a[i]=sc.nextLine();
int c=0;
for(int i=0;i<n;i++)
{
char ch=a[i].charAt(0);
if("AEIOUaeiou".indexOf(ch)!=-1)
c++;
}
System.out.println("Number of words that begin with a vowel are ::"+c);
}
}