1 solutions
-
0
C :
#include <stdio.h> int main() { char c[100]; gets(c); int i; for (i=0;i<100;i++) { if (c[i]>='A' && c[i]<='Z') { c[i]= 'A' + 26- (c[i]-'A'+1); } if (c[i]>='a' && c[i]<='z') { c[i]= 'a' + 26- (c[i]-'a'+1); } } printf ("%s\n",c); return 0; }C++ :
#include<stdio.h> #include<string.h> int main() { char s[100]; int i=0; scanf("%s",s); for(i=0;i<strlen(s);i++) { if((s[i]>='a')&&(s[i]<='z')) s[i]=219-s[i]; if((s[i]>='A')&&(s[i]<='Z')) s[i]=155-s[i]; } printf("%s",s); printf("\n"); }Pascal :
var s:ansistring; i:longint; begin read(s); for i:=1 to length(s) do begin if s[i]='A' then s[i]:='Z'; if ('A'<s[i])and(s[i]<='Z') then s[i]:=chr(ord('A')+26-(ord(s[i])-ord('A')+1)); if s[i]='a' then s[i]:='z'; if ('a'<s[i])and(s[i]<='z') then s[i]:=chr(ord('a')+26-(ord(s[i])-ord('a')+1)); write(s[i]); end; end.
- 1
Information
- ID
- 17987
- Time
- 1000ms
- Memory
- 12MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By