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”


  • goutham

    a=input(“enter the first word”)
    b=input(“enter the second word”)
    c=input(“enter the third number”)
    x,y,z=0,0,0
    V=[“a”,”e”,”i”,”o”,”u”]
    for i in a:
    if i in V:
    x=a.replace(i,”%”)
    for j in b:
    if j not in V:
    y=b.replace(j,”#”)
    z=c.upper()
    print(x+y+z)


  • Rohit

    python code
    word1=input(‘Enter word 1:’)
    word2=input(‘Enter word 2:’)
    word3=input(‘Enter word 3:’)
    vowels=[‘a’,’e’,’i’,’o’,’u’]
    numbers=[‘0′,’1′,’2′,’3′,’4′,’5′,’6′,’7′,’8′,’9′]
    words=[word1,word2,word3]
    for word in words:
    print(word)
    ”’
    print(word1)
    print(word2)
    print(word3)”’
    for i in word1:
    if i in vowels:
    word1=word1.replace(i , ‘*’)
    for i in word2:
    if i in vowels:
    continue
    elif i in numbers:
    continue
    else:
    word2=word2.replace(i,’@’)

    print(word1+word2+word3.upper())


  • satya

    varma_kanna Python Code:
    a = input(“Enter the first word :”)
    b = input(“Enter the second word :”)
    c = input(“Enter the third word :”)
    vowels = {“a”, “i”, “e”, “o”, “u”}
    for i in a:
    if i in vowels:
    print(“*”, end=”)
    else:
    print(i, end=””)
    for j in b:
    if j in vowels:
    print(j, end=””)
    else:
    print(“@”, end=””)
    for z in c:
    print(z.upper(), end=””)


  • BHAGYAPRASAD

    Python Easiest Code Ever:
    def replacevowels(test_vowels,K):
    vowels = ‘AEIOUaeiou’
    for ele in vowels:
    test_vowels = test_vowels.replace(ele,K)
    return test_vowels
    w1=input(“Enter the first word : “)
    K = ‘*’

    def replaceconsonents(test_con,L):
    consonents = ‘BCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz’
    for ele in consonents:
    test_con = test_con.replace(ele,L)
    return test_con
    w2=input(“Enter the second word : “)
    L = ‘@’

    w3 = input(“Enter the Third Word : “)

    print(replacevowels(w1,K)+replaceconsonents(w2,L)+w3.upper())


  • Saurav

    import java.util.*;
    public class Main{
    public static void main(String args[])
    {
    Scanner sc=new Scanner(System.in);
    String a=sc.nextLine();
    String b=sc.nextLine();
    String c=sc.nextLine();
    String d=””;
    char a1[]=a.toCharArray();
    char b1[]=b.toCharArray();
    char c1[]=c.toCharArray();

    for(int i=0;i<a1.length;i++)
    {
    char m=a1[i];
    if(m=='a' ||m=='e' || m=='i' || m=='o' || m=='u' || m=='A' || m=='E' || m=='I'||m=='O' ||m=='U')
    {
    a1[i]='*';
    d=d+a1[i];
    }
    else{
    d=d+a1[i];
    }
    }
    for(int i=0;i<b1.length;i++)
    {
    char n=b1[i];
    if(Character.isDigit(n))
    {
    d=d+b1[i];
    }
    else if(n!='a' ||n!='e' || n!='i' || n!='o' || n!='u' || n!='A' || n!='E' || n!='I'||n!='O' ||n!='U')
    {
    b1[i]='@';
    d=d+b1[i];
    }
    else{
    d=d+b1[i];
    }
    }
    c=c.toUpperCase();
    d=d+c;
    System.out.println(d);
    }
    }


    • Zubair

      package com.company;

      import java.io.BufferedReader;
      import java.io.InputStreamReader;
      import java.util.*;

      class Main {

      public static void main(String[]args) throws Exception {
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      String str1 = br.readLine();
      String str2 = br.readLine();
      String str3 = br.readLine();
      String res1=””,res2=””,res3=””;
      for (int i=0;i<str1.length();i++){
      char ch= str1.charAt(i);
      if (ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u'){
      res1 =res1+'*';
      }
      else {
      res1 =res1+ch;
      }
      }
      for (int i=0;i=’A’&&ch=’a’&&ch<='z')){
      if(!(ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u'||ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U')){
      res2=res2+"@";
      }
      else {
      res2=res2+ch;
      }
      }
      }
      res3 =str3.toUpperCase();
      System.out.println(res1+res2+res3);
      }
      }


  • Subhankar

    in Python:
    a=input()
    b=input()
    c=input()
    l=[‘a’,’e’,’i’,’o’,’u’]
    d=[‘0′,’1′,’2′,’3′,’4′,’5′,’6′,’7′,’8′,’9′]
    for i in a:
    if i in l:
    a=a.replace(i,’*’)
    for i in b:
    if i not in l and i not in d:
    b=b.replace(i,’@’)
    elif i in d:
    b=b
    print(a+b+c.upper())


  • KAPIL

    public class string {
    public static void main(String[] args) {
    String s1=”how”;
    String s2=”are”;
    String s3=”you”;

    String str1=””;
    String str2=””;
    String str3=””;
    char c;
    for (int i=0;i<s1.length();i++){
    c=s1.charAt(i);
    if (c=='a' || c=='e' || c=='i'|| c=='o' || c=='u' || c=='A' || c=='E' || c=='I' || c=='O' || c=='U'){
    str1=str1+"*";
    }else {
    str1=str1+c;
    }
    }
    for (int i=0;i<s2.length();i++){
    c=s2.charAt(i);
    if (c=='a' || c=='e' || c=='i'|| c=='o' || c=='u' || c=='A' || c=='E' || c=='I' || c=='O' || c=='U'){
    str2=str2+c;
    }else {
    str2=str2+"@";
    }
    }
    str3=s3.toUpperCase(Locale.ROOT);
    System.out.println(str1+str2+str3);
    }

    }


  • Code-24into7

    Python solution :-

    a = ‘how’
    #b = ‘are’
    c = ‘you’
    vowels = ‘aeiouAEIOU’
    numbers = [‘0′,’1′,’2′,’3′,’4′,’5′,’6”7′,’8′,’9′]
    b = input()

    for i in range(0,len(a)):
    x = a[i]
    if( x in vowels):
    a = a.replace(x,’*’)
    #print(a)

    for i in range(0,len(b)):
    x = b[i]
    if(x in numbers):
    break
    if( x not in vowels):
    b = b.replace(x,’@’)
    #print(b)

    c = c.upper()
    #print(c)

    res = a+b+c
    print(res)


  • Code-24into7

    a = ‘how’
    #b = ‘are’
    c = ‘you’
    vowels = ‘aeiouAEIOU’
    numbers = [‘0′,’1′,’2′,’3′,’4′,’5′,’6”7′,’8′,’9′]
    b = input()

    for i in range(0,len(a)):
    x = a[i]
    if( x in vowels):
    a = a.replace(x,’*’)
    #print(a)

    for i in range(0,len(b)):
    x = b[i]
    if(x in numbers):
    break
    if( x not in vowels):
    b = b.replace(x,’@’)
    #print(b)

    c = c.upper()
    #print(c)

    res = a+b+c
    print(res)


  • Prasanta

    word1= input(“Enter first word: “)
    word2= input(“Enter second word: “)
    word3= input(“Enter third word: “).upper()

    vowel=(“a”,”e”,”i”,”o”,”u”)

    for i in word1:
    if i in vowel:
    word1=word1.replace(i,’*’)
    for j in word2:
    if j not in vowel:
    word2=word2.replace(j,’@’)

    print(word1+word2+word3)


  • Tarmeem

    //JAVA CODE:
    import java.util.*;
    class Main{
    public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s1 = sc.next();
    char[] a1 = s1.toCharArray();
    String s2 = sc.next();
    char[] a2 = s2.toCharArray();
    String s3 = sc.next();

    for(int i=0;i<a1.length;i++)
    {
    if(a1[i]=='A' || a1[i]=='E' || a1[i]=='I' || a1[i]=='O' || a1[i]=='U' ||
    a1[i]=='a' ||a1[i]=='e' ||a1[i]=='i' ||a1[i]=='o' || a1[i]=='u' )
    a1[i]='*';
    }
    /
    for(int i=0;i<a2.length;i++)
    {
    if(!(a2[i]=='A' || a2[i]=='E' || a2[i]=='I' || a2[i]=='O' || a2[i]=='U' ||
    a2[i]=='a' ||a2[i]=='e' ||a2[i]=='i' ||a2[i]=='o' || a2[i]=='u' ))
    a2[i]='@';

    }

    s3=s3.toUpperCase();
    s1=new String(a1);
    s2=new String(a2);
    System.out.print(s1+" "+s2+" "+s3);
    }
    }