HDU 2716 Water problem

Source: Internet
Author: User
Tags printf strlen

Very water topic, depressed is my topic to see wrong

#include <iostream>
#include <string>
using namespace std;

int key[26];

void Inti (char ch[])
{
	int i;
	for (i=0;i<26;i++)
	{
		key[i]= ' a ' +i;
	}
	int Len=strlen (CH);
	for (i=0;i<len;i++)
	{
		if (ch[i]>= ' a ' &&ch[i]<= ' Z ') ch[i]=ch[i]-' a ' + ' a ';
		key[i]=ch[i]-key[i];//number of differences
	}
	while (i<26)
	{
		key[i]=0;
		i++;
	}
}

int main ()
{
	char ch[100];
	while (gets (CH))
	{
		Inti (CH);
		Gets (CH);
		int I,len=strlen (CH);
		for (i=0;i<len;i++)
		{
			if (ch[i]== ')
			{
				printf ("");
				Continue;
			}
			if (ch[i]>= ' a ' &&ch[i]<= ' z ')
				printf ("%c", ch[i]+key[ch[i]-' a ']);
			else
				printf ("%c", ch[i]+key[ch[i]-' A ']);
		}
		Putchar (' \ n ');
	}
	return 0;
}


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.