#include <iostream>
#include <fstream>
using namespace std;
int ilosc(int l){
ifstream slowa("slowa.txt");
int ilosc=0;
string str;
while(!slowa.eof()){
slowa>>str;
if(str.size() == l)
ilosc++;
}
slowa.close();
return ilosc;
}
string mirror(string str){
for(int i=0; i<str.size()/2; i++){
char h=str[i];
str[i]=str[str.size()-i-1];
str[str.size()-i-1]=h;
}
return str;
}
int main(){
ifstream slowa;
ifstream nowe;
ofstream wyniki("wyniki_04.txt");
string strS, strN;
// 5.1
wyniki<<"5.1\n";
for(int i=1; i<=12; i++)
wyniki<<i<<" "<<ilosc(i)<<endl;
// 5.2
wyniki<<"\n5.2\n";
nowe.open("nowe.txt");
for(int i=0; i<25; i++){
int ilosc=0, mirrorAmount=0;
nowe>>strN;
slowa.open("slowa.txt");
for(int j=0; j<1000; j++){
slowa>>strS;
if(strS == strN)
ilosc++;
if(strS == mirror(strN))
mirrorAmount++;
}
slowa.close();
wyniki<<strN<<" "<<ilosc<<" "<<mirrorAmount<<endl;
}
nowe.close();
wyniki.close();
return 0;
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}