Untitled - CPP 0.71 KB
                                
                                    #include <bits/stdc++.h>
using namespace std;
  
// Function to traverse the string and
// print the characters of the string
void TraverseString(string &str, int N)
{ 
    // Traverse the string
    for (int i = 0; i < N; i++) 
    {
  
        // Print current character
        if(str[i]%2==0)
        {
        cout<< char(str[i]-1)<< " ";
        }
        else
        {
        cout<< char(str[i]+1)<< " ";
        }
    }
      
}
  
// Driver Code
int main()
{
    string str = "abcdefghijklmoprstquwyxz";
      
    // Stores length of the string
    int N = str.length();

    TraverseString(str, N);
}
                                
                            

Paste Hosted With By Wklejamy.pl