HDU- 2265 Encoding The Diary

时间:2022-11-18 17:02:54

Encoding The Diary

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1289    Accepted Submission(s): 757

Problem Description
You know many girls likes writing diaries,of course they have some secrets don’t want others to know.So this time, they asked you to encoding the diary.
The rule is :
Give you a string. Such as “ARE YOU AC?”
Firstly , delete all spaces in this string.
You will get “AREYOUAC?”
String AREYOUAC?
Index 123456789
Secondly,print the characters who’s index are the multiple of 3.
Thirdly, print the characters who’s index are the multiple of 2.If it has been printed,just ignore it .
At last,print the characters that have not been printed.
 
Input
Each case will contain a string in one line.You may suppose the length of the string will not exceed 200.
 
Output
For each case, output the encoded string in one line.
 
Sample Input
ARE YOU AC?
 
Sample Output
EU?RYCAOA
 #include<stdio.h>
#include<string.h>
int main()
{
char str1[],str2[];
int i,k;
while(gets(str1))
{
k=;
for(i=;str1[i]!='\0';i++)
{
if(str1[i]!=' ')
str2[k++]=str1[i];
}
str2[k]='\0'; for(i=;i<k;i++)
{
if(i%==)
{
printf("%c",str2[i]);
str2[i]='';
}
}
for(i=;i<k;i++)
{
if(i%==&&str2[i]!='')
{
printf("%c",str2[i]);
str2[i]='';
}
}
for(i=;i<k;i++)
if(str2[i]!='')
printf("%c",str2[i]);
printf("\n");
}
return ;
}