Answer:
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Scanner;
public class WCComplement {
public static boolean palindromeWC(String input){
if(input==null)
return false;
for(int i=0,j=input.length()-1; i<j; i++, j--){
if(input.charAt(i) != input.charAt(j))
return false;
}
return true;
}
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
System.out.print("Enter input file name: ");
String fileName = sc.next();
FileReader fr = new FileReader(fileName);
BufferedReader br = new BufferedReader(fr);
String line;
while((line = br.readLine()) != null){
if(palindromeWC(line))
System.out.println(line+" is Watson-Crick complemented");
}
br.close();
fr.close();
sc.close();
}
}
Step-by-step explanation: