generated from sigonasr2/CPlusPlusProjectTemplate
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.5 KiB
49 lines
1.5 KiB
#define OLC_PGE_APPLICATION
|
|
#include "pixelGameEngine.h"
|
|
#include "olcutils.h"
|
|
|
|
using namespace olc;
|
|
|
|
int main()
|
|
{
|
|
std::ifstream file("input");
|
|
|
|
int sum=0;
|
|
while (file.good()) {
|
|
std::string line;
|
|
std::string line2;
|
|
std::string line3;
|
|
std::getline(file,line);
|
|
std::getline(file,line2);
|
|
std::getline(file,line3);
|
|
if (line.length()>0) {
|
|
std::cout<<"=========="<<std::endl;
|
|
std::cout<<line<<std::endl;
|
|
std::cout<<line2<<std::endl;
|
|
std::cout<<line3<<std::endl;
|
|
for (int i=0;i<line.length();i++) {
|
|
for (int j=0;j<line2.length();j++) {
|
|
for (int k=0;k<line3.length();k++) {
|
|
if (line[i]==line2[j]&&line2[j]==line3[k]&&line[i]==line3[k]) {
|
|
if (line[i]>='A'&&line[i]<='Z') {
|
|
int prio=27+line[i]-'A';
|
|
sum+=prio;
|
|
std::cout<<"Prio "<<prio<<" for "<<line[i]<<std::endl;
|
|
} else {
|
|
int prio=1+line[i]-'a';
|
|
sum+=prio;
|
|
std::cout<<"Prio "<<prio<<" for "<<line[i]<<std::endl;
|
|
}
|
|
goto outer;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
outer:;
|
|
}
|
|
}
|
|
|
|
std::cout<<"Sum: "<<sum<<std::endl;
|
|
|
|
return 0;
|
|
}
|
|
|