Question:-
ZeeZee Company provides an official id to its employees once they complete the pre-onboarding training. During the training, the zeezee company needs to send a mail to their personal ids. The company wants to send a mail to all the trainees. Help the company to find out the trainee’s personal mail id.
The employee’s official mail id will be employeename@zeezee.com. Find the mail domains apart from zeezee.com
[First input is the number of mail ids, the next inputs is the mail id]
Sample Input1:
5
Sample Output1:
Sample Input2:
5
Sample Output2:
Sample Input2:
5
Sample Input2:
No personal mail id
Code:-
Main.java
import java.util.*; public class Main { public static void main (String[] args) { String test="zeezee.com"; Scanner sc=new Scanner(System.in); int n=sc.nextInt(); sc.nextLine();//always give a blank nextLine if you are using string after int String email[][]=new String[n][2]; for(int i=0;i<n;i++) { email[i]=sc.next().split("@"); } int flag=0; for(int i=0;i<n;i++) { if((email[i][1]).equals(test)) { flag++; continue; } else { System.out.println(email[i][0]+"@"+email[i][1]); } } if(flag==n) { System.out.println("No personal mail id"); } } }
Recommended:-
- Array square
- Generate number using odd digits
- Alternate Number Difference
- Next Greatest number
- Mark Comparison
- Print the characters in descending order
- Vowels in a fishBowl
- Least offer
- Ascending and descending order
- Mail Domain
- Count repeating words
- Sentence – Convert to upper and lower
- Count consecutive repeating characters
- Zig zag Array
- Pass and Fail Count
- Search a Course
- Average and Grade Calculation
- String – Find and replace the character (first occurrence)
- Sort the first and second half of an array
- Retail Shop
- Palindrome
- Numerology
- InitCap
- Array Compatiblilty
- Sum of the maximum and the minimum element
- String Concatenation
- Find Average Age
- Login