1 solutions
-
0
C++ :
#include<bits/stdc++.h> using namespace std; int main() { string a; getline(cin , a); for(int i = 0;i < a.size();i++) { if(islower(a[i])) { if(a[i] == 'z') { a[i] = 'a'; } else { a[i] = a[i] + 1; } } } cout << a; return 0; }
Java :
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String n = sc.nextLine(); char c; for (int i = 0; i < n.length(); i++) { c = n.charAt(i); if(c >= 'a' && c < 'z') { c = (char) (c + 1); System.out.print(c); }else if(c=='z'){ c = (char) ('a'); System.out.print(c); }else { System.out.print(c); } } } }
- 1
Information
- ID
- 10369
- Time
- 1000ms
- Memory
- 16MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By