Find one extra character in a string | C # program to find extra character in one string ; result store the result ; traverse string A till end and xor with res ; xor with res ; traverse string B till end and xor with res ; xor with res ; print result at the end ; Driver Code ; given string
using System ; class GFG { static char findExtraCharcter ( string strA , string strB ) { int res = 0 , i ; for ( i = 0 ; i < strA . Length ; i ++ ) { res ^= strA [ i ] ; } for ( i = 0 ; i < strB . Length ; i ++ ) { res ^= strB [ i ] ; } return ( ( char ) ( res ) ) ; } public static void Main ( ) { string strA = " abcd " ; string strB = " cbdad " ; Console . WriteLine ( findExtraCharcter ( strA , strB ) ) ; } }