Tuesday, 1 March 2016

Codeforces Problem : 118A - String Task


Problem Link : http://codeforces.com/problemset/problem/118/A

Solve :

#include<stdio.h>
#include<string.h>
#include<stdlib.h>


int main()
{
    char a[202];
    int Length,Loop1,Loop2,Loop3,Length1,Place=0,i=0;

    scanf("%s",a);

    Length=strlen(a);

    for(Loop3=0; Loop3<Length; Loop3++)
    {
        for(Loop1=0; Loop1<Length; Loop1++)
        {
            if(a[Loop1]=='a' || a[Loop1]=='A' || a[Loop1]=='e' || a[Loop1]=='E' || a[Loop1]=='i' || a[Loop1]=='I' ||a[Loop1]=='o' || a[Loop1]=='O' || a[Loop1]=='u' || a[Loop1]=='U'|| a[Loop1]=='y' || a[Loop1]=='Y')
            {
                for(Loop2=Loop1; Loop2<Length; Loop2++)
                {
                    a[Loop2]=a[Loop2+1];
                }

            }

        }
    }


    Length=strlen(a);
    Length1=Length;

    for(Loop1=0; Loop1<Length; Loop1++)
    {
        for(Loop2=Length1; Loop2>i; Loop2--)
        {
            a[Loop2]=a[Loop2-1];

        }
        a[Length1+1]='\0';
        Length1=Length1+1;
        if(i>=1)
            i=i+2;
        else
            i=i+1;
        a[Place]='.';
        Place=Place+2;

    }

    strlwr(a);

    printf("%s\n",a);

    return 0;

}

No comments:

Post a Comment