[codeAC
[/code]
This is my code for the playfair cipher. It matches with the sample I/O. Can you guys give me more I/O? I don't know whats wrong with my code
11697 - Playfair Cipher
Moderator: Board moderators
-
- New poster
- Posts: 30
- Joined: Thu Jul 19, 2012 11:24 pm
11697 - Playfair Cipher
Last edited by kier.guevara on Tue Feb 26, 2013 9:48 am, edited 1 time in total.
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 11697 - Playfair Cipher
Your code is throwing a RE on the sample input, see:
https://ideone.com/7Xy8vU
https://ideone.com/7Xy8vU
Check input and AC output for thousands of problems on uDebug!
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 11697 - Playfair Cipher
row and col are size 1 and you're accessing row[1] and col[1]
Check input and AC output for thousands of problems on uDebug!
-
- New poster
- Posts: 30
- Joined: Thu Jul 19, 2012 11:24 pm
Re: 11697 - Playfair Cipher
Code: Select all
AC
}
Last edited by kier.guevara on Tue Feb 26, 2013 9:48 am, edited 1 time in total.
-
- Guru
- Posts: 5947
- Joined: Thu Sep 01, 2011 9:09 am
- Location: San Jose, CA, USA
Re: 11697 - Playfair Cipher
Try input:AC output:The text to encrypt should be all on one line.
From the problem statement:
The text to encrypt will not contain two 'x's following each other, or an 'x' as the last character, as this might cause the first rule above to repeat itself indefinitely.
Code: Select all
1
z y x w v u t s r p o n m l k j i h g f e d c b a
the playfair cipher is a manual symmetric encryption techniue and was the first digraph substitution cipher the scheme was invented in eighteen hundred fiftyfour by charles wheatstone but bears the name of lord playfair who promoted the use of the cipher the playfair cipher uses a five by five table containing each letter in the english alphabet exactly once except which is missing the table constitutes the encryption key to more easily remember the table it is typically generated from a key phrase first fill in the spaces in an empty table with the letters of the key phrase dropping spaces and duplicate letters then fill the remaining spaces with the rest of the letters of the alphabet in order the key phrase is written in the top rows of the table from left to right for instance if the key phrase is playfair example the encryption key becomes
Code: Select all
SIAUKBVIDFSBFTJCTGPCKCOTBKTXHSOCSPHDDOBSVTNDNMUDXCIDOZDKBYCPSIAJGTRSYDBLVKCMRERSDNTSJNMDFTJCPSJCMXJCOCVBTHKYDOUDYDODHFISCZDOJSIYUBAIHJNTJKTPDWXCBPOBRXJCDPRSNMDATSADBPRSJCKDOCKJKNTBRKDVAVGTXGKUULLNUDYNJCTRZJIPJCDHSFBUSIAUKBVIDFSBFTJCPTUCPCJHZADWJHZAPDWGDBNMPDDIDIJBEBGMDUUDTGINJCDOBGHTFCKRFCADUDVCDSNWNMBDCZBDUSXGHDGHMHHTTHLISIDUEAOBEMMTNDSTUDRSJCDOBSVTNDNMOATNNLLUCZDETHNWUBOCLCBUSIDUEAOBDNHTNTTFBEMWNWJBODPBUDAIULKCOAVTGSCPAJGTRSJHMWNGINJCRUEBCUDIDKCOUSTNEAOBYGSISIBODUUDPRKJSIAODZSFPBUCBTKUTFLIRUEBCUDKCYETRKHDDPBODUUDPRSIDOJHMWNRJCUBKCDIDIHRKVBDRXDNISJCUBRSKJSIBODUUDPRKJSIDEKRFCADNDMNTBBUSIAODZSFPBUCHTRLDNUDIDINJCUNUPLZUMIPJCPDWGAJULLKAJSYUNTGFGPILUDIRSDKBDHJSIAODZSFPBUCHTRKDVAVGTCZCKRKDUJCDOBSVTNDNMOAWDDBNLCU
From the problem statement:
The text to encrypt will not contain two 'x's following each other, or an 'x' as the last character, as this might cause the first rule above to repeat itself indefinitely.
Check input and AC output for thousands of problems on uDebug!
-
- New poster
- Posts: 30
- Joined: Thu Jul 19, 2012 11:24 pm
Re: 11697 - Playfair Cipher
Thanks brianfry for the input and output! A logic error 
Got AC now! Thanks again for the help!

Got AC now! Thanks again for the help!