• Study Materials – Company wise
    • Infosys Archive
    • Accenture Archive
    • AMCAT Archive
    • Capgemini Archive
    • Cisco Archive
    • CoCubes Archive
    • Cognizant(CTS) Archive
    • Dell Archive
    • Deloitte Archive
    • DXC Archive
    • Goldman Sachs Archive
    • Hexaware Technologies Archive
    • LTI Archive
    • MindTree Archive
    • TCS Archive
    • Virtusa Archive
    • Wipro Archive
  • Interview Preparation – E Books
    • C Interview Questions
    • Data Structures Interview Questions
    • DBMS Interview Questions
    • HR Interview Questions
    • Java Interview Questions
    • Operating System Interview Questions
    • Python Interview Questions
    • SQL Query Interview Questions
  • Programming
    • C Programming MCQs
    • C Code Snippets – Output Questions
    • Python Code Snippets – Output Questions
  • Aptitude
    • Verbal Ability for Placements
    • Quant for Placements
  • Register
  • Login
CODE OF GEEKS

We at CODE OF GEEKS, aim at providing best and quality content for our users at no extra cost.

    • Study Materials – Company wise
      • Infosys Archive
      • Accenture Archive
      • AMCAT Archive
      • Capgemini Archive
      • Cisco Archive
      • CoCubes Archive
      • Cognizant(CTS) Archive
      • Dell Archive
      • Deloitte Archive
      • DXC Archive
      • Goldman Sachs Archive
      • Hexaware Technologies Archive
      • LTI Archive
      • MindTree Archive
      • TCS Archive
      • Virtusa Archive
      • Wipro Archive
    • Interview Preparation – E Books
      • C Interview Questions
      • Data Structures Interview Questions
      • DBMS Interview Questions
      • HR Interview Questions
      • Java Interview Questions
      • Operating System Interview Questions
      • Python Interview Questions
      • SQL Query Interview Questions
    • Programming
      • C Programming MCQs
      • C Code Snippets – Output Questions
      • Python Code Snippets – Output Questions
    • Aptitude
      • Verbal Ability for Placements
      • Quant for Placements
    • Register
    • Login
  • [email protected]
  • ..
Login / Register
Apply Now
CODE OF GEEKS
CODE OF GEEKS
  • Study Materials – Company wise
    • Infosys Archive
    • Accenture Archive
    • AMCAT Archive
    • Capgemini Archive
    • Cisco Archive
    • CoCubes Archive
    • Cognizant(CTS) Archive
    • Dell Archive
    • Deloitte Archive
    • DXC Archive
    • Goldman Sachs Archive
    • Hexaware Technologies Archive
    • LTI Archive
    • MindTree Archive
    • TCS Archive
    • Virtusa Archive
    • Wipro Archive
  • Interview Preparation – E Books
    • C Interview Questions
    • Data Structures Interview Questions
    • DBMS Interview Questions
    • HR Interview Questions
    • Java Interview Questions
    • Operating System Interview Questions
    • Python Interview Questions
    • SQL Query Interview Questions
  • Programming
    • C Programming MCQs
    • C Code Snippets – Output Questions
    • Python Code Snippets – Output Questions
  • Aptitude
    • Verbal Ability for Placements
    • Quant for Placements
  • Register
  • Login
0

Cart

Special Reversal

  • January 6, 2020
  • CODE OF GEEKS
  • 2

You will be given a string of characters and special characters, you task is to reverse the string leaving special characters in same place.

Input : 

First Input : String

Output : Special Reverse of string



Sample Testcases :

I/P 1:

dsd$^f#

O/P 1:

fds$^d#

Solution :

s=input()
d=dict()
res=””
for i in range(len(s)):
    if s[i].isalnum()==False:
        d.update({i:s[i]})
    else:
        res+=s[i]
res=list(res[::-1])
for i,j in d.items():
    res.insert(i,j)
print(“”.join(res))


Tags: infosys last year handson problemsinfytqinfytq examinfytq examinationinfytq handson problems last yearinfytq handson problems of last yearinfytq handson questionsinfytq last year coding problemsinfytq last year problemsinfytq last year questionsLast year questions Infytqpractice infyprepare infytq question
  • Previous 4 Digit OTP
  • Next Longest Substring

2 comments on “Special Reversal”

  1. Anil Reddy says:
    April 17, 2021 at 12:20 pm

    In java:
    class Strings{
    public static void main(String args[])
    {
    String str = “dsd$^f#”;
    String str1=””;
    String str2=””;
    for(int i=0;i<str.length();i++)
    {
    if(Character.isAlphabetic(str.charAt(i)))
    {
    str1 = str1+str.charAt(i);
    }
    }
    int j=1;
    for(int i=0;i<str.length();i++)
    {
    if(Character.isAlphabetic(str.charAt(i)))
    {
    str2 = str2+str1.charAt(str1.length()-j);
    j++;
    }
    else
    {
    str2=str2+str.charAt(i);
    }
    }
    System.out.println(str2);
    }
    }

    Reply
  2. Anil Reddy says:
    April 17, 2021 at 12:23 pm

    In java:
    class Strings{
    public static void main(String args[])
    {
    String str = “dsd$^f#”;
    String str1=””;
    String str2=””;
    for(int i=0;i<str.length();i++)
    {
    if(Character.isAlphabetic(str.charAt(i)))
    {
    str1 = str1+str.charAt(i);
    }
    }
    int j=1;
    for(int i=0;i<str.length();i++)
    {
    if(Character.isAlphabetic(str.charAt(i)))
    {
    str2 = str2+str1.charAt(str1.length()-j);
    j++;
    }
    else
    {
    str2=str2+str.charAt(i);
    }
    }
    System.out.println(str2);
    }
    }

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

CODE OF GEEKS

Subscribe to Newsletter

CODE OF GEEKS

Learn | Code | Achieve

Reach us

[email protected]
We at CODE OF GEEKS, aim at providing quality content to our users at no cost.
CODE OF GEEKS

Important Pages

About us
Advertise
Privacy Policy
Terms and Conditions

Placements – Study Materials

TCS NQT     Wipro     CapGemini
Accenture     MindTree     CTS
DXC     Hexaware Technologies     AMCAT
CoCubes     Goldman Sachs     Dell
Cisco     Deloitte     Virtusa     LTI     Infosys   

Courses

  • Mail Us
  • Login/Register

Recent Posts

TCS Reasoning 2021
  • October 4, 2021
TCS Verbal 2021
  • October 4, 2021

Copyright 2021 CODE OF GEEKS. All Rights Reserved.

  • →