2 solutions
-
3
#include<bits/stdc++.h> using namespace std; const int N=90; char s[N]; int main() { cin.getline(s,N); int n=strlen(s); for(int i=0;i<n;i++) { if(s[i]>='a'&&s[i]<='y'||s[i]>='A'&&s[i]<='Y') { s[i]=s[i]+1; } else if(s[i]=='z'||s[i]=='Z') { s[i]=s[i]-'z'+'a'; } } cout<<s; return 0; }
-
-2
#include <bits/stdc++.h> using namespace std; const int N=210; char a[N]; char b[N]; int main() { cin.getline(a,N); int n=strlen(a); for(int i=0;i<n;i++) { if(a[i]=='z' || a[i]=='Z') { b[i]=char(int(a[i])-25); } else { if(('a'<=a[i] && a[i]<='z')||('A'<=a[i] && a[i]<='Z')) { b[i]=char(int(a[i])+1); } else b[i]=a[i]; } } cout<<b; return 0; }
- 1
Information
- ID
- 920
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 1
- Tags
- (None)
- # Submissions
- 62
- Accepted
- 26
- Uploaded By