Coding Discussions
Would you like to react to this message? Create an account in a few clicks or log in to continue.

sholay part 2.please share better solutions.my solution is giving time out

Go down

sholay part 2.please share better solutions.my solution is giving time out Empty sholay part 2.please share better solutions.my solution is giving time out

Post by akarshsomani Thu Apr 13, 2017 8:22 pm

package program;
import java.util.Scanner;

public class fuzzy {
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);

int l1=sc.nextInt();
int l2=sc.nextInt();
String a[]=new String[l1];
String b[]=new String[l2];
for(int i=0;i<l1;i++)
{
a[i]=sc.next();
}
for(int i=0;i<l2;i++)
{
b[i]=sc.next();
}
int c=0;
for(int i=0;i<l1;i++)
{
for(int j=0;j<l2;j++)
{
int f=0;
String app=a[i].concat(b[j]);
for(int k=65;k<=90;k++)
{
if(app.indexOf((char)k)==-1)
{
f=1;
break;
}
}
if(f==0)
{
c++;
}
}
}
System.out.println(c);
}
}

akarshsomani

Posts : 21
Join date : 2017-04-04

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum