TCS Coding 1. The program will recieve 3 English words inputs from STDIN These three words will be read one at a time, in three separate line

1. The program will recieve 3 English words inputs from STDIN

  1. These three words will be read one at a time, in three separate line
  2. The first word should be changed like all vowels should be replaced by *
  3. The second word should be changed like all consonants should be replaced by @
  4. The third word should be changed like all char should be converted to upper case
  5. Then concatenate the three words and print them

Other than these concatenated word, no other characters/string should or message should be written to STDOUT

For example if you print how are you then output should be h*wa@eYOU.

You can assume that input of each word will not exceed more than 5 chars

Test Cases

Case 1

Input

  • how
  • are
  • you

Expected Output : h*wa@eYOU

Case 2

Input

  • how
  • 999
  • you

Expected Output : h*w999YOU

94 comments on “TCS Coding 1. The program will recieve 3 English words inputs from STDIN These three words will be read one at a time, in three separate line”


  • Prajakta

    3 word code in python :-
    Vowel =[“a”,”e”,”I”,”o”,”u”]
    A= str(input ())
    B= str(input())
    C=str(input())
    For X in a:
    If x in vowel:
    A=a. Replace (a,”*”)
    For y in b :
    If y in vowel:
    B= b.replace(b,”@”)
    C= c.upper()
    Word= a+b+c
    Print (word)


  • Nagasai

    Using Java Code
    import java.util.*;

    class HelloWorld {
    public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    System.out.println(“First input”);
    String s1=sc.next();
    System.out.println(“Second input”);
    String s2=sc.next();
    System.out.println(“Third input”);
    String s3=sc.next();
    String s11=””;
    String s22=””;
    String s33=””;
    for(int i=0,j=0,k=0;i<s1.length() && j<s2.length() && k=97 && s3.charAt(k)<=122){
    s33+=Character.toUpperCase(s3.charAt(k));
    k++;
    }
    else{
    k++;
    }
    }

    System.out.println(s11+s22+s33);

    }
    }


  • Nagasai

    Using Java Code
    import java. util.*;

    class fing {
    public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    System.out.println(“First input”);
    String s1=sc.next();
    System.out.println(“Second input”);
    String s2=sc.next();
    System.out.println(“Third input”);
    String s3=sc.next();
    String s11=””;
    String s22=””;
    String s33=””;
    for(int i=0,j=0,k=0;i<s1.length() && j<s2.length() && k=97 && s3.charAt(k)<=122){
    s33+=Character.toUpperCase(s3.charAt(k));
    k++;
    }
    else{
    k++;
    }
    }

    System.out.println(s11+s22+s33);

    }
    }


  • sharonsuresh2001

    #using PYTHON code
    —————————

    str1=input()
    str2=input()
    str3=input()
    l=[‘a’,’e’,’i’,’o’,’u’]
    l1=[]

    for ch in l:
    for ch1 in str1:
    if(ch==ch1):
    str1=str1.replace(ch1,”*”)
    for ch2 in str2:
    if ch2 not in l:
    l1.append(ch2)
    for ch3 in l1:
    for ch2 in str2:
    if(ch3==ch2):
    str2=str2.replace(ch2,”@”)
    str3=str3.upper()
    print(str1+str2+str3)


  • sharonsuresh2001

    #using PYTHON code

    str1=input()
    str2=input()
    str3=input()
    l=[‘a’,’e’,’i’,’o’,’u’]
    l1=[]

    for ch in l:
    for ch1 in str1:
    if(ch==ch1):
    str1=str1.replace(ch1,”*”)
    for ch2 in str2:
    if ch2 not in l:
    l1.append(ch2)
    for ch3 in l1:
    for ch2 in str2:
    if(ch3==ch2):
    str2=str2.replace(ch2,”@”)
    str3=str3.upper()
    print(str1+str2+str3)


  • Gunasekaran

    #include

    int main()
    {
    char s[10000];
    int i,l=1;
    scanf(“%[^\n]”,s);
    for(i=0;s[i]!=0;i++)
    {
    if(s[i]==’ ‘)
    {
    // printf(“\n”);
    l++;
    continue;
    }
    else if(l==1)
    {
    if(s[i]==’a’||s[i]==’A’||s[i]==’e’||s[i]==’E’||s[i]==’i’||s[i]==’I’||s[i]==’o’||s[i]==’O’||s[i]==’u’||s[i]==’U’)
    printf(“*”);
    else
    printf(“%c”,s[i]);
    }
    else if(l==2)
    {
    if(s[i]==’a’||s[i]==’A’||s[i]==’e’||s[i]==’E’||s[i]==’i’||s[i]==’I’||s[i]==’o’||s[i]==’O’||s[i]==’u’||s[i]==’U’)
    printf(“%c”,s[i]);
    else if(s[i]>=’0’&&s[i]=’a’&&s[i]<='z')
    printf("%c",s[i]-32);
    }
    }
    return 0;
    }


  • 1DA19CS132

    Using Python:
    ——————————–
    v=[“a”,”e”,”i”,”o”,”u”]
    lst=[]
    s1,s2,s3=””,””,””
    for i in range(3):
    n=input()
    lst.append(n)
    for i in lst[0]:
    if i in v:
    s1+=”*”
    else:
    s1+=i
    for i in lst[1]:
    if i in v:
    s2+=i
    else:
    s2+=”@”
    for i in lst[2]:
    s3+=i.upper()
    print(s1+s2+s3)
    ——————————–


  • 19131A04L9

    x=list(input())
    y=list(input())
    z=input()
    c=[‘a’,’e’,’i’,’o’,’u’]
    for i in range(len(x)):
    if x[i] in c:
    x[i]=”%”
    for i in range(len(y)):
    if y[i] not in c:
    y[i]=”#”
    print(“”.join(x)+””.join(y)+z.upper())


  • Adil

    a=[str(d) for d in str(input(“enter a word:”))]
    b=[str(d) for d in str(input(“enter a word:”))]
    c=[input(“enter a word:”).upper()]
    for i in range(0,len(a)):
    if (a[i]==”a” or a[i]==”e” or a[i]==”i” or a[i]==’o’ or a[i]==’u’):
    a[i]=”*”
    for i in range(0,len(b)):
    if((b[ i ]>=’a’ and b[i]=’A’ and b[i]<='Z')):
    if (not(b[i]=="a" or b[i]=="e" or b[i]=="i" or b[i]=='o' or b[i]=='u')):
    b[i]="@"
    print(a + b + c )


  • Anil

    x=[]
    for i in range(3):
    x.append(input())
    str1=”
    str2=”
    str3=”
    for i in range(3):
    if i==0:
    for j in range(len(x[0])):
    if x[0][j] in “aeiouAEIOU”:
    str1=str1+’%’
    else:
    str1=str1+x[0][j]
    if i==1:
    for j in range(len(x[1])):
    if x[1][j] not in “aeiouAEIOU” and x[1][j].isalpha():
    str2=str2+’#’
    else:
    str2=str2+x[1][j]
    if i==2:
    for j in range(len(x[2])):
    if x[2][j].isalpha() and x[2][j].islower():
    str3=str3+x[2][j].upper()
    else:
    str3=str3+x[2][j]
    print(str1,str2.strip(),str3,sep=”)

    x=[]
    for i in range(3):
    x.append(input())
    str1=”
    str2=”
    str3=”
    for i in range(3):
    if i==0:
    for j in range(len(x[0])):
    if x[0][j] in “aeiouAEIOU”:
    str1=str1+’%’
    else:
    str1=str1+x[0][j]
    if i==1:
    for j in range(len(x[1])):
    if x[1][j] not in “aeiouAEIOU” and x[1][j].isalpha():
    str2=str2+’#’
    else:
    str2=str2+x[1][j]
    if i==2:
    for j in range(len(x[2])):
    if x[2][j].isalpha() and x[2][j].islower():
    str3=str3+x[2][j].upper()
    else:
    str3=str3+x[2][j]
    print(str1,str2.strip(),str3,sep=”)


  • Aviral

    Using Java CODE :-
    ===========
    import java.util.*;
    public class Main
    {
    public static void main(String[] args) {
    Scanner s=new Scanner(System.in);
    System.out.println(“Enter First String”);
    String str1=s.nextLine();
    System.out.println(“Enter Second String”);
    String str2=s.nextLine();
    System.out.println(“Enter third String”);
    String str3=s.nextLine();
    str3=str3.toUpperCase();
    String res=””;
    for(int i=0;i<str1.length();i++)
    {
    char ch=str1.charAt(i);
    if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')
    {
    str1=str1.replace(ch,'*');
    }//end of if
    }//end of for loop
    for(int i=0;i<str2.length();i++)
    {
    char ch=str2.charAt(i);
    if(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')
    {
    continue;
    }//end of if
    else if(ch=='0'||ch=='1'||ch=='2'||ch=='3'||ch=='4'||ch=='5'||ch=='6'||ch=='7'||ch=='8'||ch=='9')
    {
    continue;
    }
    else{
    str2=str2.replace(ch,'@');
    }
    }//end of for loop
    res=res.concat(str1).concat(str2).concat(str3);
    System.out.println(res);
    }
    }


  • Mohammad

    a=input()

    b=input()
    c=input()
    for i in a:
    if i in “aeiou”:
    print(a.replace(i,”*”))
    for i in b:
    if i not in “aeiou”:
    print(b.replace(i,”@”))

    d=c.upper()
    print(d)