Coding | EXAMS | IBM ACCENTURE | VIRTUSA | IBM | AMAZON | TCS | EPAM | WILEY EDGE | TECH MAHINDRA | JPMORGAN | HCL | WIPRO
3.37K subscribers
1.13K photos
3 videos
17 files
373 links
Main channel https://t.me/Coding_000
Contact Admin 👉 @ILOVEU_143 for booking your exam slots
Web- https://coding000.github.io/Projects/
💯% clearance in any placement exams
OffCampus -https://t.me/Offcampus_000
Discussion- https://t.me/exams_discussion
Download Telegram
Guys...questions.. are difficult...
I will try to post...all pls wait...😊
3
def encrypt_decrypt(message, key_phrase):
    words = message.split()
    key_words = key_phrase.split()
    reversed_key_words = key_words[::-1]
    result = []
    for i in range(len(words)):
        if i < len(key_words):
            current_key_word = reversed_key_words[i]
        else:
            current_key_word = reversed_key_words[i % len(key_words)]
        result.append(words[i] + current_key_word)
    return ' '.join(result)

if name == 'main':
    message = input("Enter message: ")
    key_phrase = input("Enter key phrase: ")
    print(encrypt_decrypt(message, key_phrase))



Python3
👍5🔥1
decryptmessage

Guys plagiarism will be checked so please change method order and variable name 

Share @Coding_000❤️
1🔥1
🔥To Apply  For Latest Jobs and Internships and Offcampus links

🙋 Please Check
👇

https://t.me/Offcampus_000
1👍1
👉 VIRTUSA

Exam Help Available
Note: It's Paid 💰💰

Msg: @ILOVEU_143

Test Clearance Guaranteed👨‍💻

Share @Coding_000 ❤️😊
👍2🔥1
Capgemini pip exam help available

Exam Help Available
Note: It's Paid 💰💰

Msg: @ILOVEU_143

Test Clearance Guaranteed👨‍💻

Share @Coding_000 ❤️😊
👍2
Coding | EXAMS | IBM ACCENTURE | VIRTUSA | IBM | AMAZON | TCS | EPAM | WILEY EDGE | TECH MAHINDRA | JPMORGAN | HCL | WIPRO
Photo
public class StringSwap {
    public static String performOperations(String initialString, int numOperations, int[] operationsArray) {
        StringBuilder currentString = new StringBuilder(initialString);

        for (int operation : operationsArray) {
            if (operation == 1) {
               
                char temp = currentString.charAt(0);
                currentString.setCharAt(0, currentString.charAt(currentString.length() - 1));
                currentString.setCharAt(currentString.length() - 1, temp);
            } else if (operation == 2) {
               
                int middle = currentString.length() / 2;
                String firstHalf = currentString.substring(0, middle);
                String secondHalf = currentString.substring(middle);
                currentString = new StringBuilder(secondHalf + firstHalf);
            }
        }

        return currentString.toString();
    }

    public static void main(String[] args) {
        String initialString = "ABCD";
        int numOperations = 2;
        int[] operationsArray = {1, 2, 1};

        String result = performOperations(initialString, numOperations, operationsArray);
        System.out.println(result);
    }
}


Virtusa in java🆓

Share @Coding_000❤️
🔥1🥰1