Untitled
Guest 41 6th Dec, 2022 Unlisted
#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);
}
To share this paste please copy this url and send to your friends
RAW Paste Data
Recent Pastes
- Untitled
Markup | 19 | 23 hours ago
- Untitled
Markup | 25 | 1 day ago
- Wanted to see what your conviction is on this theme
Markdown | 16 | 1 day ago
- Untitled
Markup | 67 | 2 days ago
- mega555kf7lsmb54yd6etzginolhxxi4ytdoma2rf77ngq55fhfcnyid.onion
Template Toolkit 2 | 27 | 2 days ago
- Untitled
Markup | 72 | 3 days ago
- Untitled
Markup | 80 | 3 days ago