1 solutions

  • 0
    @ 2025-11-5 18:32:12

    C :

    #include <stdio.h>
    #include<string.h>
    int main()
    {
        char a[110];
        char b[60];
        gets(a);
        for (int i = 0; i < strlen(a); i++)
        {     
            if (i==strlen(a)-1)
            {
                b[i] = a[i] + a[0];
            }
            else
            b[i]=a[i]+a[i+1];
        }
        puts(b);
    }
    
    

    C++ :

    #include <iostream>
    #include <cstdio>
    #include <cstring>
    using namespace std;
    const int N = 10010;
    char ch[N];
    int main()
    {
        string s;
        getline(cin , s);
        for (int i = 0; i < s.size() - 1; ++i) printf("%c",s[i] + s[i+1]);
        printf("%c",s[0] + s[s.size()-1]);
    
        return 0;
    }
    
    • 1

    Information

    ID
    18914
    Time
    1000ms
    Memory
    128MiB
    Difficulty
    (None)
    Tags
    # Submissions
    0
    Accepted
    0
    Uploaded By