You are on page 1of 2

import java.util.

Scanner;

public class Flames {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

int count = 0;
int count1 = 0;
int sum = 0;

System.out.print("Enter your name: ");


String name = sc.nextLine().toLowerCase();
System.out.print("Enter your crush name: ");
String name1 = sc.nextLine().toLowerCase();

name = name.replace(" ", "");


name1 = name1.replace(" ", "");

char [] yourName = new char[name.length()];


char [] crushName = new char[name1.length() ];

for(int i = 0; i < name.length() ; i++) {

char temp = name.charAt(i);


yourName[i] = temp;
}

for(int i = 0; i < name1.length() ; i++) {

char temp = name1.charAt(i);


crushName[i] = temp;
}

for(int i = 0; i < yourName.length; i++) {


for(int j = 0; j < crushName.length; j++) {

if(yourName[i] == crushName[j]) {

if(yourName[i] != '*' && crushName[j] != '*') {

yourName[i] = '*';
crushName[j] = '*';
}
}
}
}

for(int i = 0; i < yourName.length; i++) {


if(yourName[i] == '*') {
count++;
}
}
for(int i = 0; i < crushName.length; i++) {
if(crushName[i] == '*') {
count1++;
}
}

sum = count + count1;

if(sum == 1|| sum == 7) {


System.out.println("Friends");
}

if(sum== 2|| sum == 8) {


System.out.println("Lovers");
}

if(sum == 3|| sum == 9) {


System.out.println("Admirer");
}

if(sum == 4|| sum == 10) {


System.out.println("Married");
}

if(sum == 5|| sum == 11) {


System.out.println("Enemy");
}

if(sum == 6|| sum == 12) {


System.out.println("SweetHeart");
}

System.out.println(sum);

}
}

You might also like