#include<iostream>
#include<string>
using namespace std;
int main()
{
string in;
cin >> in; //Take input
string variable, coefficientString; //Variable declerations
for(unsigned int i = 0; i < in.length(); ++i)
{
unsigned int currentVal = (int)in.c_str()[i]; //Get the integer value of the current character
if(currentVal > 47 && currentVal < 58) //On an ASCII table all integers are between 47 and 57, in this case a number has been entered
{
coefficientString += in.c_str()[i]; //All numbers are added to a string for the coefficient
}
else
{
variable += in.c_str()[i]; //All non-numerical values are being considered variables, you may want to limit this to alphabetical only
}
}
int coefficient = atoi(coefficientString.c_str()); //The string is then converted to an integer
coefficient *= coefficient; //As an example to show this works, coefficient is squared
variable += variable; //Variable is also squared, in this case it is represented by repeating the variables
cout << coefficient << variable;
return 0;
}
I2luY2x1ZGU8aW9zdHJlYW0+CiNpbmNsdWRlPHN0cmluZz4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCkKewoJc3RyaW5nIGluOwoJY2luID4+IGluOyAvL1Rha2UgaW5wdXQKCQoJc3RyaW5nIHZhcmlhYmxlLCBjb2VmZmljaWVudFN0cmluZzsgLy9WYXJpYWJsZSBkZWNsZXJhdGlvbnMKCQoJZm9yKHVuc2lnbmVkIGludCBpID0gMDsgaSA8IGluLmxlbmd0aCgpOyArK2kpCgl7CgkJdW5zaWduZWQgaW50IGN1cnJlbnRWYWwgPSAoaW50KWluLmNfc3RyKClbaV07IC8vR2V0IHRoZSBpbnRlZ2VyIHZhbHVlIG9mIHRoZSBjdXJyZW50IGNoYXJhY3RlcgoJCWlmKGN1cnJlbnRWYWwgPiA0NyAmJiBjdXJyZW50VmFsIDwgNTgpIC8vT24gYW4gQVNDSUkgdGFibGUgYWxsIGludGVnZXJzIGFyZSBiZXR3ZWVuIDQ3IGFuZCA1NywgaW4gdGhpcyBjYXNlIGEgbnVtYmVyIGhhcyBiZWVuIGVudGVyZWQKCQl7CgkJCWNvZWZmaWNpZW50U3RyaW5nICs9IGluLmNfc3RyKClbaV07IC8vQWxsIG51bWJlcnMgYXJlI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