Skip to main content

TCS

TCS OA-10 2024

Problem Description

Write a program that generates a modified password based on an initial password and an increment value, following these requirements:

  1. The initial password must be at least 8 characters long.
  2. It must contain at least:
    • One integer,
    • One special character from the set {'#', '@'},
    • One uppercase letter, and
    • One lowercase letter.

The program takes two inputs:

    • A string representing the initial password.
    • An integer n representing the number of times each character in the password should be incremented.

For each character in the initial password, increment its ASCII value by n and update the character accordingly. The program should output the final modified password, meeting the specified conditions.

Input Format

  • The first line contains a string S, representing the initial password.
  • The second line contains an integer n representing the number of times each character should be incremented.

Output Format

Print the modified string.

Constraints

  • 1 ≤ S.length ≤ 10⁵
  • 1 ≤ n ≤ 15

Example

Sample Input:

vdqU@321
2

Sample Output:

xfsW#543

Explanation:

Each character in the input string is incremented 2 times.