U E D R , A S I H C RSS

압축알고리즘/수진&재동

===해제알고리즘/수진&재동===
~cpp 
#include <iostream>
using namespace std;

int main()
{
	char input[20];
	cin >> input;

	int i=0;
	char standard = input[0]; 
	i++;
	while(input[i] != '\0'){
		char c = input[i];
		if(isdigit(c) != 0){
			if (c == '-')
			{
				i++;
				char c = input[i];
				int diff = atoi(&c);
				cout << (char)((int)standard - diff);
			}
			else
			{
				int diff = atoi(&c);
				cout << (char)((int)standard + diff);
			}
		}
		else
		{
			cout << c;
			standard = c;
		}
		i++;

	}
	cout << endl;
	return 0;
}
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:30:23
Processing time 0.0152 sec